I have a ng-click
event on an <i>
tag that looks like this:
ng-click="parent.Status != 'Open' || (item.Status='Retrospect')"
So if parent.Status is not equals to Open then item Status is set to Retrospect, this is ok.
But I want another check, I want to see if this item is editable, for this I have a bool variable, edit
. Naturally I wrote it like this:
ng-click="parent.Status != 'Open' && edit || (item.Status='Retrospect')"
So, I thought that if parent.Status is not equals to Open AND edit equals true my item.Status will be updated, problem is that it was updated no matter if edit
was true or false (thinking it's because the first check is true, so it doesn't care about edit
)
i also tried it like this, but same problem:
ng-click="(parent.Status != 'Open' && edit) || (item.Status='Retrospect')"
.. using ( )
What am I missing? Should this not be possible?
EDIT: Seems like when doing like this:
ng-click="parent.Status != 'Open' || (item.Status='Retrospect')"
item.Status will be set to 'Retrospect' if parent.Status != 'Open' resovles to false
, but the problem still persist.
Also, there may be some confuison here I think, I am not checking if parent.Status != 'Open'
OR item.Status='Retrospect'
I am running the command item.Status='Retrospect'
IF parent.Status != 'Open'
equals false
My bad Okay, I am so confused right now, but my code did in fact work, the problem was my understanding of ng-click
true/false
evaluation and also I used !=
instead of !==
which may have caused some issues.
I will upvote most of the answers (cause all of you were right, just not me) and accept what helped me to understand the most. Thanks all!