简体   繁体   中英

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:

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

Any suggestions on how to ask for the state in ng-show / ng-hide?

Use $state.includes('landing') in your js. It defines current state.

For example:

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

Then in your HTML :

ng-hide = "hide";

这应该可以解决您的问题

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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