简体   繁体   English

AngularJS:模块

[英]AngularJS: Modules

Let's say that we have this: 假设我们有这个:

In 'app/app.module.one' I define the dependencies for AngularJS module by passing in the 'app.module.two' module as a second parameter eg 在“ app / app.module.one”中,我通过传入“ app.module.two”模块作为第二个参数来定义AngularJS模块的依赖项,例如

var app = angular.module('app.module.one', ['app.module.two']);

My question is: can I in 'app.module.two' module make use of services and factories from 'app/app.module.one' ?? 我的问题是:我可以在“ app.module.two”模块中利用“ app / app.module.one”中的服务和工厂吗?

否。如果您都需要同时使用服务,则应将该代码放在较低级别的模块(例如app.module.base )中,然后app.module.oneapp.module.two都需要需要它( app.module.base )。

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

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