sogo/UI/WebServerResources/js/Common/user-model.js

27 lines
706 B
JavaScript
Raw Normal View History

2014-10-20 19:52:35 +02:00
(function() {
'use strict';
function User() {}
/* The factory we'll use to register with Angular */
User.factory = ['sgSettings', 'sgResource', function(Settings, Resource) {
angular.extend(User, {
$$resource: new Resource(Settings.baseURL)
});
return User; // return constructor
}];
/* Factory registration in Angular module */
2014-10-21 20:44:48 +02:00
angular.module('SOGo.Common').factory('User', User.factory);
2014-10-20 19:52:35 +02:00
/* Instance methods
* Public method, assigned to prototype
*/
User.prototype.$filter = function(search) {
// return a collections of users for a filter
2014-10-20 19:52:35 +02:00
var param = {search: search};
2014-10-21 20:44:48 +02:00
return User.$$resource.fetch(null, "usersSearch", param);
2014-10-20 19:52:35 +02:00
};
})();