成人在线亚洲_国产日韩视频一区二区三区_久久久国产精品_99国内精品久久久久久久

您的位置:首頁技術(shù)文章
文章詳情頁

javascript - 如何理解angular的這段代碼?

瀏覽:93日期:2024-03-07 10:09:00

問題描述

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參數(shù)$scope.UrlGet = $$.getUrlParams();//聲明[’title’,’$http’,’$scope’,’$state’,’$stateParams’,function( title , $http , $scope , $state , $stateParams ) { $scope.UrlGet = $$.getUrlParams();

問題解答

回答1:

既然你已經(jīng)說了require,那代碼就很好明白了。define 是require里的,定義一個模塊。[’app’] 是一個依賴數(shù)組,直白點說就是,這個模塊依賴了一個app的模塊,把這個app引入進來,重命名為 APP。這個APP提供了controller這個方法,由此可知,這個APP應(yīng)該就是一個 angular module

標簽: JavaScript
相關(guān)文章: