AngularJS learning --- Routing (Routing) & amp; Multiple Views (Multiple Views) step 7

Source: Internet
Author: User

1. Switch the branch to Step 7 and start the project git checkout step-7npm start2. requirement: in the checkout file. The next step is to add a page that displays details of each cell phone in our list. Let's take a look at the differences between the code in Step 6 and Step 7. To increase the detailed information view, we can expand index.html to contain the template code of two views at the same time, but this will soon bring us great trouble. In contrast, we need to convert the index.html Template into a "layout template ". This is a general template that applies all views. Other "local layout templates" are subsequently filled in based on the current "Route" to form a complete view for users. The routing applied in AngularJS is declared by $ routeProvider, which is the provider of the $ route service. This service makes it easy to integrate controllers, view templates, and the URL of the current browser. With this feature, we can implement deep links, which allow us to use the browser's history (back-to-back or Forward Navigation) and bookmarks. Obviously, when accessing http: // localhost: 8000/app, its URL is redirected to the http: // localhost: 8000/app/#/phones page. 4. implement code app/index.html to copy the Code <! Doctype html>

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.