Debojyoti Debojyoti - 8 months ago 16
Javascript Question

How to use xor functionality in angular js expression?

The html is

<form name="businessFormAbout" ng-show="(businessFormAbout.$submitted)^(businessForm.$submitted)">

This is the 2nd form. By default this form will be hidden until the first form is submitted. Again it will show when the first form is submitted. After the second one(this form tag)is submitted again it will hide.

will be true when [1^0 = 1], [0^0 = 0] and [1^1 = 0]. I have the condition sorted out using other logical or bitwise operators. I want to know why xor operator is not working in AngularJS.

I would like to ask - how AngularJS parses or evaluates passed expressions to directives (as ng-show is directive)

[As this question is put on hold,I cannot answer to this question myself.So I am editing the question with the answer in this section.This was an issue with angular documentation.They did not documented this unavailability of bitwise xor functionality.So I added this issue on their github page and this was committed.]


You can simulate xor operation by != instead (if both values are boolean, and in your case they are):

<form name="businessFormAbout" ng-show="businessFormAbout.$submitted != businessForm.$submitted">