restangular
restangular copied to clipboard
Wrap object as a promise
To wrap object as a angular promise i can use $q.when
var _data;//lazy or eager strategy
function getData(){
if (!this._data){
_data = $http.get('data.json');
}else{
_data = $q.when(_data);
}
return _data;
}
I need to be sure that i always dealing with a promise from getData() method. How can i do same for restangular with it private restangularizePromise() method?
I have no idea what you're trying to do. Can you provide a more concrete example?
Year has passed, long overdue :)
My apologies. The original author of this project has passed it on, so I and a couple of other people are trying to clean it up. There are so many issues to go through right now that it's been hard keeping up.
Is this still an issue for you?
no, you can close
Hi f0def, how did you manage to solve your problem? I'm having similar issue.
Sorry, but no, I dropped this angular project, now I use the react :)
Nvm I think I figured out. You can do this.
var _data = null;
function getData() {
if (_data) { return _data; }
_data = Restangular.get();
return _data;
}