【发布时间】:2015-08-13 20:42:18
【问题描述】:
我在 app.js 中有以下内容
config = angular.module('config', [])
.constant('Constants', {
Car: 'BMW',
Phone: 'G4'
});
services = angular.module('services', ['config']);
controllers = angular.module('controllers', ['config', 'services']);
app = angular.module('myApp', ['config', 'controllers']);
我想将“config”模块定义移动到一个单独的文件中,因为我希望它会变得更大。
是否可以将以下部分移动到单独的文件中:
config = angular.module('config', [])
.constant('Constants', {
Car: 'BMW',
Phone: 'G4'
});
【问题讨论】:
-
你不能改变常量值......
-
可以有很多文件..不清楚确切的问题是什么或你在问什么。然而,应该将模块分组为功能而不是组件
-
为了清楚起见,我已经编辑了问题。
-
Is it possible...您不应该先尝试一下吗?如果你做了什么问题出现了? -
@charlietfl 因为我们不能在 javascript 中“包含”其他文件。
标签: javascript angularjs coffeescript