如何理解angular的这段代码?

https://img4.mukewang.com/5c185d530001bd2405800623.jpg

维护别人的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();


MMTTMM
浏览 519回答 1
1回答

叮当猫咪

既然你已经说了require,那代码就很好明白了。define 是require里的,定义一个模块。['app'] 是一个依赖数组,直白点说就是,这个模块依赖了一个app的模块,把这个app引入进来,重命名为 APP。这个APP提供了controller这个方法,由此可知,这个APP应该就是一个 angular module
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript