javascript - Both angular and jquery use the $ symbol, will there be any conflict if used together?
世界只因有你
世界只因有你 2017-06-14 10:50:38
0
6
924

For example, $scope.op = $('#box'), the two $ before and after belong to different libraries. . Will there be any problem

世界只因有你
世界只因有你

reply all(6)
漂亮男人

No.
$ in jQuery is equivalent to jQuery being a variable $scope
in angular, $http, etc. are also separate variableswhere $ is just a part of the variable name, such as var $abc = 'abc'
where $ will not conflict with $ in jQuery

伊谢尔伦

I don’t think so

迷茫

$scope and $ are two completely different variable names that have no relationship. . .

伊谢尔伦

No way~
$scope You can treat it as an object... $ It’s another object
like var abc=1; var a=2; There will be no conflict between these two objects.. .

阿神

The

$ in $scope is just a prefix of a variable and has nothing to do with $. The $ in jQuery is a real variable.

给我你的怀抱

You can redefine a symbol for jQuery and release the control of $,
For example:
`var $j = jQuery.noConflict();
$j(".box").on("click",function(){ //code});
`

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template