簡體   English   中英

在ng-show / ng-hide中詢問狀態

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

我只想在當前狀態不是“着陸”狀態時顯示特定的導航點(配置文件,朋友)。 我將AngularJS與ui-router一起使用,如果我執行以下操作,它似乎不起作用:

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

關於如何在ng-show / ng-hide中詢問狀態的任何建議?

在您的js中使用$state.includes('landing') 它定義了當前狀態。

例如:

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

然后在您的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