Skip to content

Instantly share code, notes, and snippets.

@noeticpenguin
Created January 8, 2014 20:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noeticpenguin/8324025 to your computer and use it in GitHub Desktop.
Save noeticpenguin/8324025 to your computer and use it in GitHub Desktop.
bootstrapping an ng app after manual remoting calls. Jason, Essentially, you want to do this:
<!doctype html>
<html xmlns:ng="http://angularjs.org">
<body>
Hello {{'World'}}!
<script src="http://code.angularjs.org/angular.js"></script>
<script>
angular.element(document).ready(function() {
RemoteJSCall.then(function(results){
//manipulate results if needed.
//do whatever with results to get app ready
angular.module('myApp', []);
angular.bootstrap(document, ['myApp']);
}
});
</script>
</body>
</html>
@tehnrd
Copy link

tehnrd commented Jan 8, 2014

So you are initializing the app in callback of the remoting call. Makes sense, but let's say you get an array of objects back in the remoting call and you need to apply this to $scope.objects in the myApp controller. How do you do this?

Second question, let's say the Remoting call is lower priority and does not need to complete before app init. Instead we want ngApp to init as soon as possible and then on completion of init do the remoting call and update $scope.objects in the controller.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment