Javascript 角度,ui路由器:如何从指令模板显示?
我使用的代码如下:Javascript 角度,ui路由器:如何从指令模板显示?,javascript,angularjs,angular-ui-router,sails.js,Javascript,Angularjs,Angular Ui Router,Sails.js,我使用的代码如下: ng-show="current == $state.includes('<Your State Name>')" 我的模板代码是: 问题: 仅当我的ui路由器的状态为“anon.about”时,如何从“header.html”中“ngShow”一个“div”?如果需要检查模板中的状态,可以执行以下操作: ng-show="current == $state.includes('<Your State Name>')" 为你的问题创建一个fid
ng-show="current == $state.includes('<Your State Name>')"
我的模板代码是:
问题:
仅当我的ui路由器的状态为“anon.about”时,如何从“header.html”中“ngShow”一个“div”?如果需要检查模板中的状态,可以执行以下操作:
ng-show="current == $state.includes('<Your State Name>')"
为你的问题创建一个fiddle或更好的plunker,然后更好地编写代码并给出适当的解决方案。我无法为你创建plunker。但是,我的代码与我在问题中发布的代码相同。您可以在PC中使用此代码进行尝试?请帮助我。说真的,我哭了。会想出一个好主意的别担心嗨,我查过你的密码了,你想让ng秀在哪里?
.state('anon.about', {
url: '/about',
templateUrl: 'about.html',
controller: function($rootScope,$state){
console.log($state.current.name);
$rootScope.currentStateName = $state.current.name;
}
})