Ui-router is the 3rd party route for Angular. He is not much different from ngrouter.Ui-router can be deeply nestedNgrouter simple nesting, needles for a single view (view is a page that needs to be nested)For example: We clicked on a link, we need to jump to the specified page in the view, then Ngroute has met our needs, and when we click, we need to jump in different places to two different pages, Ngroute is not enough, We need to use the
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.
Increase in Ui-router
$locationProvider. Html5mode (True);2. Add the. htaccess file to the root directory and addRewriteengine on# If an existing asset or directory are requested go to it as it isrewritecond%{document_root}%{request_ur i}-f [Or]rewritecond%{document_root}%{request_uri}-drewriterule ^-[l]# If The requested resource doesn ' t exist, use I Ndex.htmlrewriterule ^/index.html3. Add in the head tag of index.html4. If the style is invalid a
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.