Hi,
You should return it inside a promise, and then use it inside a .then at
the place you need it. (no need for $q. and using deffered's is usually
considered an antipattern!)
function checkNikeUrl(url, size, inventoryData) {
return $http.get(url).then(function(response) {
var url = 'http://www.nike.co.uk/search?q=' + code;
return checkNikeUrl(url, size, inventoryData);
if(store === 'nike') {
return checkNike(store, code, size);
//$log.debug(inventoryData);
//return inventoryData;
}
Then, where you need it:
checkInventory()
.then(function(inventoryData){
// do something with the data. most of the time it's jsut assigning
it to a controller value
$ctrl.inventoryData = invertorydata;
})
Hope this helps you a bit,
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.