Disable or enable elements based on settings


#1

Hello Everyone,

How can I properly use a settingspage.
I have two toggles in my settingspage

    <ion-item>
        <ion-label> Sound</ion-label>
        <ion-toggle checked="false"></ion-toggle>
    </ion-item>
    <ion-item>
        <ion-label> Hints</ion-label>
        <ion-toggle checked="false"></ion-toggle>
    </ion-item>

Now when someone toggles the hint button, it should dissappear in actionPage. How can I hide this button ?

        <button ion-button (click)="getHint()">
            <ion-icon ios="ios-help" md="md-help"></ion-icon>
        </button>

Thanks in advance!


#2

Store your settings in a SettingsService, inject it in both the settings page (where you write its hintsEnabled property) and in the action page, where you read the hintsEnabled property in an *ngIf directive on the hint button.


#3

Thanks for your suggestion / solution.
I feel kinda dumb not thinking of that myself.
Have a great day :smiley: