New to AngularJS and an attempt to understand the structure and try to create a basic CRUD application. I cannot understand what is needed to update an existing record. Here is my service:
angular.module('appServices', ['ngResource']). factory('App', function ($resource) { var Item = $resource('App/:AppId', { //Default parameters AppId: '@id' }, { //Actions query: { method: 'GET', isArray: true }, getById: { method: 'PUT' }, update: { method: 'POST' } }); return Item; });
I can run the basic Get all and getById request to fill out the edit form, but where I am stuck. Here is a sample code for getById
$scope.apps = App.query(); $scope.getEdit = function(AppId) { App.getById({id:AppId}, function(app) { $scope.original = app; $scope.app = new App(app); }); }; $scope.save = function() {
I think I'm just not sure what next with respect to updating existing information or how the application object will be passed to the API, can someone point me in the right direction or show me a quick update method?
source share