vendredi 23 octobre 2015

What happens if anyone GET url created by angular

I'm very new to Web developing and Angular.JS and my question might be so simple. And also excuse me about my terrible English.

in the Angularjs website, and in the API Reference section, when you click on links, the URL changes in the location bar, I know this is done by $routeProvider.when() method so I call it a Fake URL because this URL only refers to the sub page not whole page with layout, because, when we click on a link, just the sub page is loaded into ng-view not the whole page including header, footer etc.(layout at all).

I mean it's possible they have something like this:

 $routeProvider
 .when('/$routeProvider', {
     templateUrl: '/$routeProvider',
     controller: 'routeProviderCtrl',
 })

and certainly the html file returned by /$routeProvider does not contain anything about page layout!! because it doesn't need to. I Mean if we enter http://ift.tt/1kyHBZP in the location bar we'll get a sub-page template! which will load into ngview.

But for example this URL http://ift.tt/1eNAzw5, if we enter this URL in the location bar and press enter (send a GET) whole the page with all layout specific parts will be load!

my question is HOW?

what happens when we enter a URL which is created by AngularJS? How can i handle that and decide to send whole page or just template?




Aucun commentaire:

Enregistrer un commentaire