我的编译指令存在问题,其中注入的工厂返回undefined。我已经检查了拼写,它全部检查出来。
我使用
动态插入指令var elDetails = $compile('<profiles></profiles>')($scope);
我的个人资料
app.directive('profiles', function() {
return {
restrict: 'E',
replace: true,
scope:{},
templateUrl: '/Redesign/Scripts/App/Blocks/profiles.html',
link: function(scope, elem, attrs) {
},
controller: function($scope, Profiles) {
$scope.profiles = new Profiles();
}
}
});
我还有一个名为Profiles的工厂,它看起来像这样:
app.factory('Profiles', function($http) {
var Profiles = function() {
this.items = [];
this.busy = false;
this.after = 0;
this.orderBy = 'CreatedDate,CompletedDate';
this.filter = '';
};
我做错了什么?感谢。
约翰。
答案 0 :(得分:2)
app.factory('Profiles', function($http) {
var Profiles = function() {
this.items = [];
this.busy = false;
this.after = 0;
this.orderBy = 'CreatedDate,CompletedDate';
this.filter = '';
};
return Profiles;
});