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