angular : ui-router 操做原理

<body>
    <a ui-sref="title">title<a>
</body>

ui-router 会去解析body里的ui-sref,title对ui-router来讲是一种状态,接着会去找着状态ide

$stateProvider
  .state('title', {
     url: '/title',
     ...
  })

state就是状态,发现了就会把ui

<a ui-sref="title">title<a>

 换成正常的href="title"url

 


 

路径:www.example.comspa

首先去when找,找到redirectcode

没有去state找,找到就走router

没有去otherwise,再去when对象

 

        $urlRouterProvider.
                    when("/", "/home").
                    otherwise("/");            

 

×全部的状态头能够是参数blog

 

 

23-OCT-2015it

<a ui-sref="{{$state.current.name}}(stateParam)">GO</a>

在searhing 时能够注入stateParam这对象。class

相关文章
相关标签/搜索