Noshii
Noshii

Reputation: 486

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?

Upvotes: 0

Views: 302

Answers (2)

Prakash R
Prakash R

Reputation: 47

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";

Upvotes: 1

Tushar
Tushar

Reputation: 1123

This should solve your issue

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

Upvotes: 0

Related Questions