AngularJS realize the value of the address bar

Sometimes we made the following requirements

1, to jump from a.html b.html

2, carrying a parameter and values ​​from the time jump,

3, removed from the b.html pass over the parameter values

In the following the operation AngularJS

Add in the a.html

< A the href = '# b.html? =. 5 Test' > jump to b.html </ A >

Note here that must be used to pass parameters to use AngularJS #? Pass parameters, or they will not receive.

The codes AngularJS b.html

var id = $location.search()['test'];

Value pass over the test value obtained is the id of

Guess you like

Origin www.cnblogs.com/kitor/p/11298977.html