负载角度依赖关系之间的区别是什么,共享模块的最佳方式是什么

What are the differences between load angular dependencies and what is the best way to share modules?

本文关键字:是什么 共享 模块 最佳 方式 区别 依赖 关系 之间 负载      更新时间:2024-01-25

这些加载模块的方式有什么区别?

angular.module('CoreApp', ['...','...','...','...']); //parent module
angular.module('MainApp1', ['CoreApp']);  //child 1
angular.module('MainApp2', ['CoreApp']);  //child 2
angular.module('CoreApp', ['...','...','...','...','MainApp1','MainApp2']); //parent module
angular.module('MainApp1', []);  //child 1
angular.module('MainApp2', []);  //child 2

除此之外,也许我做错了。我的mainApps将在不同的域(mainapp1.com和mainapp2.com)中运行。我有一些页眉(登录名、菜单)和页脚,我想共享它们,而不是在每个模块上复制和更改它们。我当然有指令和服务(比如翻译服务)。

我不知道什么是最好的方法。我想用coreapp创建一个私有的bower包,并将其加载到其他项目中。我还希望开发过程尽可能舒适。

有更好的主意吗?

感谢

  1. 每个应用程序只有一个主模块
  2. 您可以基于父模块创建子模块
  3. 我不认为您可以在不同的域中运行子模块,因为子模块将在主模块之后加载/实例化