我有这个非常讨厌的问题。我需要能够从私有模块模式中访问公共模块功能。我已经在有问题的一行写了评论......有什么方法可以做到这一点吗?
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
}
}]);