繁体   English   中英

Angular模块依赖性

[英]Angular module dependency

是否可以在没有任何依赖性的情况下启动我的角度模块?

这是我的angular.module

 angular.module("app", [ 'ngSanitize', 'ngAnimate', 'ui.router', 'ngMaterial', 'ngRoute', 'ngCookies', 'NgSwitchery', 'ngCkeditor', 'angularFileUpload', ]); 

我不想使用,它们是1号的必需项。 加载中。 'NgSwitchery','ngCkeditor','angularFileUpload'

谢谢。

是的,您可以使用条件来传递依赖关系。

var dependencyArray = ['dep1', 'dep2'];
if (someCondition) {
    dependencyArray = ['dep1', 'dep2', 'dep3', 'dep4'];
}

  angular.module('app',dependencyArray); 

如果尝试在不同时间加载它们,则可能需要requireJS。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM