Why should ANGULARJS use Html5mode when using Ui-router?

Source: Internet
Author: User

Why should we use the html5mode=true when using angular ui-router?

In angular, when you visit a link, you may access the link as "#/link".

If you set up html5mode=true, this time the page will be redirected to the "/link" page.

If you set the Html5mode=false, you need to precede the link with a symbol such as "#/link" when you access it.

So, setting html5mode=true doesn't affect your HTML5 code, it's just more convenient to access.

Add $locationProvider. Html5mode (True) in the App. config configuration file. hashprefix ('! ') Configuration information.

Need to set <base href= "/" > in the Portal file of the page, i.e. index.html

Why should ANGULARJS use Html5mode when using Ui-router?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.