Dha*_*ana 9 html javascript jquery angularjs
我想知道如何在我的角度函数中调用jQuery函数,就像我有一个jquery函数,如:
function testData(){
// code
}
Run Code Online (Sandbox Code Playgroud)
我有一个角度函数,如:
myApp.controller(AppCtrl,['$scope', function($scope) {
$scope.imagesData = function(){
//here I need to call the function: testData()
}
}]);
Run Code Online (Sandbox Code Playgroud)
所以,请告诉我如何在angularjs函数($ scope.imagesData())中调用我的testData().提前致谢.
Muh*_*sir 11
用户定义的函数不依赖于jQuery.如果你想调用jQuery你jQuery之前应该包含的内置函数angularjs.在这里你应该使用jQuery前缀来避免与angularjs功能冲突
myApp.controller(AppCtrl,['$scope', function($scope) {
$scope.imagesData = function() {
testData();//calling jquery function visible in given scop
jQuery('#id').next();//getting element sibling
}
}]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
19027 次 |
| 最近记录: |