0004-Program Flow 2

Source: Internet
Author: User

According to the traditional way of operation, usually click on a button or a menu item, we will page by the way of specifying a URL to jump,

In HTML, the use of the traditional a-tag href attribute as a jump, in the case of using ui-router, we have a button

Add the Ui-sref property, which is the route state for the button. Note that the routing URLs described here are related to the state. Just before

Those properties that are configured in state.

The use of Ui-router is much more detailed, but this is only a simple example:

1. State (' Demostate ', {2Parent: ' Site ',3URL: '/demo/{id} ',4 data: {5PageTitle: ' Demo page '6     },7 Views : {8' [Email protected] ': {9Templateurl: ' demo.html ',TenController: ' Democontroller.js ' One         } A     }, - Resolve: { -datas:[' MyService ',function(myservice) { the             returnmyservice.query ({}); -         }] -     } -})
Demostate is my custom state, if when a button contains the property ui-sref= "Demostate ({id:1})", then click on this button will jump to demostate this route, where Id:1 is the parameter passed to the route
Corresponds to the {id} in the URL in the state configuration, and when this button is clicked, the URL of the browser is changed to/DEMO/1 according to the URL in the state, and the URL corresponding to the view template is demo.html. The corresponding controller is democontroller.js.
In this step, you can write logic on the controller of the view.

0004-Program Flow 2

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.