The following code example works well:
Auth_controller.prototype.isLogged = function(){
var getAuthStatus = this.auth_model.fetch();
return getAuthStatus;
};
Auth_controller.prototype.redirect = function(fragment, args, next){
var getAuthStatus = this.isLogged();
var self = this;
$.when(getAuthStatus).then(function(response){
}
});
This does not seem to work for the collection. When I register a collection with the console, I get an empty collection.
I know that I can use the success callback function from a method (already tested), but I don't want to do this because I want the function to return a promise that I can call from other functions: good.
Edit -> No, I'm sorry that it does not work in the callback with success either as it seems.
Any suggestions on a workaround?
Change
, .
- , , , .
, , , , .

Edit2:
:
define([
'jquery',
'underscore',
'backbone',
'models/users/role_model'
], function($, _, Backbone,
Role_model){
var Role_collection = Backbone.Collection.extend({
url: '/ingeb/api_v1/users/roles',
model: Role_model
});
return Role_collection;
});