Monday, November 21, 2016

Controller Update Note


// Update Note
app.controller('UpdateNoteCtrl', function($scope, noteService, $stateParams, $state){
$scope.notes = noteService.all;
$scope.singleNote = noteService.get($stateParams.id);
$scope.title = $scope.singleNote.title;
$scope.body = $scope.singleNote.body;
$scope.myid = $scope.singleNote.$id;


$scope.updateNote = function(id){
var ed = $scope.notes.$getRecord(id);
ed.title = $scope.title;
ed.body = $scope.body;
$scope.notes.$save(ed);
$state.go('editNote');
}
});

No comments:

Post a Comment