angularjs - TypeError: Cannot read property '$fetch' of undefined -
i using angular-js,angular-restmod , ui-router build app has following restmod models
app.factory('event', function(restmod) { return restmod.model('v1/events').mix( { user: {belongsto: 'user', key: 'user_id'} } ); }); app.factory('user', function(restmod) { return restmod.model('v1/users'); });
i have controller lists events present in database
app.controller('eventscontroller', function($scope,event,user) { $scope.eventslist = []; var events = event.$search(); (event in events) { event.user.$fetch(); } $scope.eventslist = events; })
i getting error - typeerror: cannot read property '$fetch' of undefined line 'e.user.$fetch();'
i cannot figure out wrong in code. can please.
Comments
Post a Comment