【发布时间】:2015-09-25 15:25:51
【问题描述】:
有没有办法根据控制器内部的条件加载/指定模块?
var app = angular.module('app',['ngRoute']);
app.controller("DemoCtrl",["$scope",function($scope){
var a = true;
if(a)
// Load "Yes" module to app
else
// Load "No" module to app
}]);
【问题讨论】:
-
load modules到底是什么意思? -
@charlietfl 我的意思是为 ngRoute 等应用程序指定模块。在这里,应用程序使用 ngRoute,我只想根据控制器中的条件向应用程序添加一个模块
-
需要第三方惰性加载器,如 ocLazyLoad。在
v1.xxangular 中还没有内置任何内容
标签: javascript angularjs angularjs-module