angular.js - How to use angular core components in a custom function?
阿神
阿神 2017-05-15 16:52:33
0
1
593
var app = angular.module('controllers', []);
app.controller('StoreSignUpCtrl', function($scope, $state, $q){});

You can inject these system components and use them by referencing $scope, $state, $q, $ionicActionSheet in the controller.
How can I use these components if I customize a function?

var myFun = function($q){};
阿神
阿神

闭关修行中......

reply all(1)
过去多啦不再A梦

Your functions all appear in a controller or instruction or a service or block in Angular, and all of the above can be imported into Angular's internal library, so the functions you define can definitely be used,

For example, you have to define the function in a directive

angular.module('controllers', []).directive('mydirective',['$timeout',function($t){
    var myFun = function($t){};//这样就可以用到 系统的组件$timeout了 
}])

If you don’t understand anything, you can continue discussing

(I’m not sure where the function you defined is, so the answer may not be what you want)

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