I need to save the data obtained from the background in a model on the home page and then transfer it to subsequent web pages to use the data in this model. I've read a lot of information but still don't understand the parameter passing in ui-router. Can anyone write a demo example for me to see?
黄舟2017-05-15 17:10:58
There are N ways to pass parameters. There may be mistakes in typing by hand. Please forgive me.
路由配置
$stateRouter.state('first.second',{
url:'first/second/:type/:id', //传type参数和id参数,可以用url显示传,也可以调用$state.go()传。
templateUrl:'tempUrl',
params //这个也可以传参,不在url显示
})
写一个service,service是单例的,a页面存数据,b页面获取数据,代码简单就不写了。
html5支持的本地存储,类似cookie,但是比cookie存的数据要多。刷新也还会有。
直接调用windows.localStorge就可以了。