angular.js - angular的state配置问题
PHP中文网
PHP中文网 2017-05-15 17:13:33
0
2
585


代码截图如上,里面的data是用来做什么用那?劳烦各位大神多多指教了

PHP中文网
PHP中文网

认证0级讲师

reply all(2)
淡淡烟草味

Official document address
https://ui-router.github.io/n...$stateProvider

Explanation about the data of $stateProvider.state

Arbitrary data object, useful for custom configuration. The parent state's data is prototypally inherited. In other words, adding a data property to a state adds it to the entire subtree via prototypal inheritance.

Machine translation

Arbitrary data object, suitable for custom configuration. The data of the parent state is prototypically inherited. In other words, adding a data attribute to a state adds it to the entire subtree via prototypal inheritance.

Simply put, it is a custom configuration of routing. You can get this value as a parameter in the controller

世界只因有你
function Ctrl($state){
    console.log($state.current.data.status) // outputs "1";
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template