Angularjs How To Change Part Of A Model
I have action links on a page that change parts of the model. The links have ng-click functions that fire a server action that returns the part of the model that was altered. I ass
Solution 1:
This should do it:
GuideControllers.controller('VideoDetailCtrl', ['$scope', '$http', '$routeParams', 'Video',
function($scope, $http, $routeParams, Video, Preference) {
$scope.video = Video.get({ id: $routeParams.id });
$scope.addToWatchlist = function(id) {
$http.get('/api/preference/'+id+'/add_to_watchlist.json').success(function(data) {
$scope.video.prefs = data;
});
}
}
]);
Post a Comment for "Angularjs How To Change Part Of A Model"