Page 1 of 1

Hide select menu

Posted: Sat Aug 22, 2020 3:44 am
by Todd Mortensen

Hi,
I want to hide a select menu based on some value. The select item wrapper is named "selDayOfWeek". I have an event that I created to evaluate the condition of another element, but can't quite find the typescript that would disable it. The older examples I find in the forums don't seem to work with ionic 4.
I feel like I should be able to do something like this.Apperyio(selDayOfWeek).Disabled(false), but it doesn't play.
Any help would be appreciated,
Thanks


Re: Hide select menu

Posted: Mon Aug 24, 2020 3:43 pm
by brendanm@ite.co.za

Have you tried a *ngIf angular directive?


Re: Hide select menu

Posted: Mon Aug 24, 2020 4:27 pm
by Serhii Kulibaba

Hello,

@brendanm is right. Please define a global variable for that and use it in the *ngIf property of that menu item https://angular.io/api/common/NgIf


Re: Hide select menu

Posted: Tue Aug 25, 2020 4:54 am
by Todd Mortensen

Thanks this worked great. That and a youtube video got me on my way.

All I had to do was add:
*ngIf as an attribute for the selectWrapper with a value of the boolean variable that I created for the page.
Then I made a Typescript event based off another element that would toggle that boolean variable between false and true and it shows up or hides based on that value.

Actually easier then the other approach I was trying.

Thanks,