简体   繁体   English

在ng-show / ng-hide中询问状态

[英]Ask for state in ng-show / ng-hide

I only want to show specific navigation points (profile, friends) when the current state is not the state "landing". 我只想在当前状态不是“着陆”状态时显示特定的导航点(配置文件,朋友)。 Im using AngularJS together with ui-router, if i do the following, it doesn't seem to work: 我将AngularJS与ui-router一起使用,如果我执行以下操作,它似乎不起作用:

ng-hide="$state == 'landing'"

Any suggestions on how to ask for the state in ng-show / ng-hide? 关于如何在ng-show / ng-hide中询问状态的任何建议?

Use $state.includes('landing') in your js. 在您的js中使用$state.includes('landing') It defines current state. 它定义了当前状态。

For example: 例如:

if($state.includes('landing')){
   $scope.hide = true;
}

Then in your HTML : 然后在您的HTML中:

ng-hide = "hide";

这应该可以解决您的问题

<div ng-hide="$state.current.name == 'landing'"> </div>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM