私はこの本当に厄介な問題を抱えています。プライベート モジュール パターン内からパブリック モジュール関数にアクセスできるようにする必要があります。問題のある行にコメントを書きました...これを行う方法はありますか?
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
}
}]);