javascript - 如何理解angular的這段代碼?
問(wèn)題描述
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(); }]);}); 維護(hù)別人的angular 代碼 用了require 不太明白這段代碼的開(kāi)頭的部分,請(qǐng)大神指點(diǎn)指點(diǎn) 尤其是define([’APP’],function(APP){’use strict’;APP.controller(’CuisineController’, [’title’,’$http’,’$scope’,’$state’,’$stateParams’,function( title , $http , $scope , $state , $stateParams ) {//獲取url參數(shù)$scope.UrlGet = $$.getUrlParams();//聲明[’title’,’$http’,’$scope’,’$state’,’$stateParams’,function( title , $http , $scope , $state , $stateParams ) { $scope.UrlGet = $$.getUrlParams();
問(wèn)題解答
回答1:既然你已經(jīng)說(shuō)了require,那代碼就很好明白了。define 是require里的,定義一個(gè)模塊。[’app’] 是一個(gè)依賴(lài)數(shù)組,直白點(diǎn)說(shuō)就是,這個(gè)模塊依賴(lài)了一個(gè)app的模塊,把這個(gè)app引入進(jìn)來(lái),重命名為 APP。這個(gè)APP提供了controller這個(gè)方法,由此可知,這個(gè)APP應(yīng)該就是一個(gè) angular module
相關(guān)文章:
1. docker - 各位電腦上有多少個(gè)容器???容器一多,自己都搞混了,咋辦呢?2. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””3. mac里的docker如何命令行開(kāi)啟呢?4. 關(guān)于docker下的nginx壓力測(cè)試5. Docker for Mac 創(chuàng)建的dnsmasq容器連不上/不工作的問(wèn)題6. nignx - docker內(nèi)nginx 80端口被占用7. docker容器呢SSH為什么連不通呢?8. 如何解決Centos下Docker服務(wù)啟動(dòng)無(wú)響應(yīng),且輸入docker命令無(wú)響應(yīng)?9. docker start -a dockername 老是卡住,什么情況?10. dockerfile - 我用docker build的時(shí)候出現(xiàn)下邊問(wèn)題 麻煩幫我看一下

網(wǎng)公網(wǎng)安備