search

Home  >  Q&A  >  body text

angular.js - angular state configuration problem


The screenshot of the code is as above. What is the data in it used for? I’d like to thank all the masters for your advice

PHP中文网PHP中文网2855 days ago630

reply all(2)I'll reply

  • 淡淡烟草味

    淡淡烟草味2017-05-15 17:15:33

    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

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-15 17:15:33

    function Ctrl($state){
        console.log($state.current.data.status) // outputs "1";
    }

    reply
    0
  • Cancelreply