I have created a custom method update with method type put.
I want to catch the success and fire some event there.
Does anyone have fair idea how to do it?
SERVICE
(function () {
'use strict';
// this function is strict...
angular
.module('zdma.organization.services', [])
.factory('Organization', function($resource, Config) {
var Organization = $resource(
Config.url.organization + '/:id',
{
id: '@id'
},
{
'update': {
method: 'PUT'
}
}
);
// class methods
Organization.getEmptyOrganizationTemplate = function () {
return {
'id': '',
'name': '',
'declarationCode': '',
'website': ''
};
};
return Organization;
});
}());
In controller
angular
.module('zdma.organization.controllers', [])
.controller('OrganizationCreateCtrl', function($scope, $location, Organization) {
function init() {
$scope.organization = new Organization(Organization.getEmptyOrganizationTemplate());
}
$scope.save = function() {
$scope.organization.$save();
};
init();
});
Can you help me how can i do it in this case?
Please assume that my model updates on the base of view