Hmm, can't you include the json file with the routes, instead of doing a jsonp ? That would be better.
<script src="angular.js">
<script src="myApp.js">
<script src="routes.js">
If you really want to load the routes asynchronously, you would have to some hack, say, something like this:
var nastyGlobalReferenceToRouteProvider;
appModule.config(function($routeProvider) {
nastyGlobalReferenceToRouteProvider = $routeProvider;
});
// later, when you get the routes, call nastyGlobalReferenceToRouteProvider.when(...)
That should work, you would probably have to do $route.reload() after adding the routes, otherwise $route would miss the initial route.
V.
You received this message because you are subscribed to the Google Groups "AngularJS" group.