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();
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