I'm looking through angularjs examples, I've found this example:
// This is a module for cloud persistance in mongolab - https://mongolab.com
angular.module('mongolab', ['ngResource']).
factory('Project', function($resource) {
var Project = $resource('https://api.mongolab.com/api/1/databases' +
'/angularjs/collections/projects/:id',
{ apiKey: '4f847ad3e4b08a2eed5f3b54' }, {
update: { method: 'PUT' }
}
);
Project.prototype.update = function(cb) {
return Project.update({id: this._id.$oid},
angular.extend({}, this, {_id:undefined}), cb);
};
Project.prototype.destroy = function(cb) {
return Project.remove({id: this._id.$oid}, cb);
};
return Project;
});
I don't want using magic string static resource such as https://api.mongolab.com/api/1/databases/angularjs/collections/projects/:id
, instead I would like to have it defined on server and later passed into the module. My question is, how do you parametrize module, i.e. how do you pass a javascript variable into the module from outside?