ngShow / ng Hide

24 views
Skip to first unread message

AMOL BADGAUJAR

unread,
Aug 7, 2017, 9:28:09 AM8/7/17
to Angular and AngularJS discussion
Hello Experts,

I am new to Angular4 , where i am facing an issue with usage of ng-Show and ng-Hide in Angular 4. The exact issue is its not working based on the condition provided in ng-Show tag.
Could you please help me here to understand it in better way.

Rgds,
-Amol

Sander Elias

unread,
Aug 7, 2017, 9:38:34 AM8/7/17
to Angular and AngularJS discussion
Hi Amol,

ngShow and ngHide are not part of Angular Version 2 and up. So adding that to elements will not do anything. Have a look at *ngIf or use the the hidden attriibute that is on most HTML elements.
like:

<div [hidden]='MustHide === true">blah</div>


Be aware that the hidden attribute doesn't work on all elements, and not in all situations.

Regards
Sander

Bhuvan Ram

unread,
Aug 8, 2017, 10:35:44 AM8/8/17
to Angular and AngularJS discussion
ng-Show and ng-Hide doesn't work in Angular 4. you can assign the HTML attribute "hidden" to HTML element with the help of logic using one way binding "[]"
<p [hidden]='You boolean logic">This paragraph should be hidden.</p>
Reply all
Reply to author
Forward
0 new messages