angular 的 uiRouter 的 方法$state.includes (判断当前激活路由)
作用:
该方法用于判断当前激活的也就是地址栏的路由地址是哪个路由。
比如 $state.includes(‘app’) 那么如果页面地址为“www.baidu.com#/app” 或者 “www.baidu.com#/app/xxx” 的时候,该方法的值会返回true。
(一般我们定义的路由和地址栏地址是相互对应的,方便管理。举例也是在app.xxx对应app/xxx这样设置路由的情况下)如激活的路由为 app.page.page1 那么
1
2
3$state.includes('app') //返回 true
$state.includes('app.page') //返回 true
$state.includes('app.page.page1') //返回 true