0

I am building an app that is supposed to guide a customer through a series of questions to get the proper product depending on the customers needs.

The app needs to make a JSONP call to an API call to get the data for products and questions, and the whole app is dependent on this data.

Does Angular have any kind of support for this scenario? Preferably I don't even want to start the app until the data has arrived, only showing a loading screen or something similar.

I have tried to make a JSONP call and doing the ng.module('myApp') in the callback, but then I get some Angular errors because the module 'myApp' doesn't exists yet (since Angular will boot up before the JSONP call is back).

What can I do?

Thanks in advance

1 Answer 1

1

In the controller :

$scope.data = null;
$http.jsonp(...).success(function(data) { $scope.data = data; });

And in the view:

<div ng-show="!data">Loading...</div>
<div ng-show="data">Show the questions here</div>
1
  • Thanks! But then I'll have to do it in each controller, right? Maybe that is how it's going to be done.
    – Emil
    Aug 22, 2013 at 11:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.