Thursday, 19 September 2013

Asyncronous server call, resource, angular

Asyncronous server call, resource, angular

I'm very confused. I hope you can help me.
This is my factory
productsFactory.getAllDiciplines = function(){
return $resource('/api/disciplines/');
}
It returns an array.
This is my controller:
$scope.diciplines = ProductsFactory.getAllDiciplines().query();
This is my view:
<select ng-model="diciplines" ng-options="d.dp_title for d in
diciplines"></select><br>
This works. However, when I choose an item in my selectbox. It get's
empty. All items disappear. I know this has something do to with that
$resource uses asyncronous calls.
How do I fix this?

No comments:

Post a Comment