Wednesday, 15 February 2012

angularjs - Routing for Home Page and URL's for Website -


I am creating a website with many HTML files which are connected with the ionic framework and for transferring between states I am using AngularJS. I was wondering what it means in #Arr and what role does it play in state transfer? If I have

  & lt; A href = "# / app / page 2" & gt; Hi & lt; / A & gt; As there is an href on a lesson  

is a way of configuring the URL so that instead of saying localhost / index.html # / app / page2 , it Just localhost /index.html/page2 without "# / app" ? I have tried

  $ locationProvider.html5Mode (true);  

But it is not working

First of all, What does this mean in the # in a url

Any URL that contains any # characters is a piece URL # On the left side of the URL, a part of such a resource Identifies the browser that can be downloaded and the part to the right, known as a piece identifier, specifies a location inside the resource

Read more here ->

In other words: After the whole code can be "Service" after requesting # . Actually that the post of # is never sent in any http request

with the default angle in # works in the URL is. This means that the angular router will only lift the URL when they have #. Then in your controller, you can grab the request using AJAX and get your required data.

  http://example.com/#/about http://example.com/#/contact  

You can call it html5mode < / Code>, you can put it in your router config:

  $ locationProvider html5Mode (true);  

Then its URL should look like this and angular router should work fine.

  http://example.com/about http: // example .com / contact  

I recommend not using # URLs Older, my old option is using the normal URL.


No comments:

Post a Comment