【发布时间】:2014-08-19 16:09:19
【问题描述】:
我有这个非常烦人的问题。我需要能够从私有模块模式中访问公共模块功能。我已经对有问题的行写了评论...有什么办法吗?
angular.module("myApp").factory('models', [function () {
function itemModel(dtoItem) {
this.type = dtoItem.type;
}
function groupModel(dto) {
this.items = [];
angular.forEach(dto.getFeatures(), function (item) {
self.items.push(new itemModel(item)); //THIS NEEDS TO BE self.items.push(new ItemModel(item)); (Notice the use of the capital letter to denote a public function) so that I can run a test externally and check the type of the 'items'
});
}
return {
ItemModel: itemModel,
GroupModel: groupModel
}
}]);
【问题讨论】:
标签: javascript angularjs jasmine revealing-module-pattern