I want to make something actions in function only when variable is true.
This changeAddressPermision variable changes in popup - when user click cancel changeAddressPermision is false, and when user click confirm changeAddressPermision is true. Popup looks like this:
<div *ngIf="!isPopupClosed" class="popup">
<p class="popup__text">Are you sure you want to change address?</p>
<div class="popup-button__div">
<button class="popup__button" (click)="isPopupClosed = true; changeAddressPermision = true">Yes</button>
<button class="popup__button" (click)="isPopupClosed = true; changeAddressPermision = false">Cancel</button>
</div>
</div>
It should work like this:
Function x listen to variable change - if user click Yes - popup close and function x do something based on changeAddressPermision. It should wait for user click on popup and if user click something - its do something based if changeAddressPermision == false or true