javascript - How to understand this code in angular?
阿神
阿神 2017-06-05 11:10:14
0
1
495

define(['APP'],function(APP){
'use strict';
APP.controller('CuisineController', 
        ['title','$http','$scope','$state','$stateParams',
function( title , $http , $scope , $state , $stateParams ) {
    
        $scope.UrlGet = $$.getUrlParams();
        
        $scope.Load = {
            
            initValue : function(){
            },
            
            Jump: function(index) {
                $state.go('cuisineDetails',{'index':index});
            },
            bussiness: function() {
                
            },
            init : function(){
                $$('.ModalBlank.ModalBlankVisibleIn').tap().click();
        
                window.setTitle(title);
                //$scope.Load.setUseTime();
                $scope.Load.initValue();
                //$scope.Load.bussiness();
        
                window.initDeviceReady($scope.Load.bussiness);
            }
        };
        
        $scope.Load.init();
    }]);
});    

维护别人的angular 代码   用了require     不太明白这段代码的开头的部分,请大神指点指点 尤其是

define(['APP'],function(APP){
'use strict';
APP.controller('CuisineController', 
        ['title','$http','$scope','$state','$stateParams',
function( title , $http , $scope , $state , $stateParams ) {
        //获取url参数
        $scope.UrlGet = $$.getUrlParams();
        //声明
        ['title','$http','$scope','$state','$stateParams',
function( title , $http , $scope , $state , $stateParams ) {
    
        $scope.UrlGet = $$.getUrlParams();
阿神
阿神

闭关修行中......

reply all(1)
阿神

Now that you have said require, the code is easy to understand.
define is in require, defining a module.
['app'] is a dependency array.
To put it bluntly, this module depends on an app module. Import this app and rename it to APP. This APP provides the controller method. From this, it can be seen that this APP should be an angular module

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