Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Logic problem
Message
General information
Forum:
HTML5
Category:
Coding, syntax and commands
Title:
Miscellaneous
Thread ID:
01657073
Message ID:
01658050
Views:
43
>>>>You have mixed AND and ORs w/o any parenthesis to distinct how they should be tested.
>>>>So maybe this should be:
>>>>
>>>>if( (this.form && !this.form.$dirty) || 
>>>>    (this.parentForm && !this.parentForm.$dirty))
>>>>...
>>>>
>>>
>>>It is not my code, but I was thinking about something like this and both times I restored back to original code. This one doesn't seem correct to me. It doesn't do (I think) what the intent of the code is. The intent is to check if the forms defined. If they are defined, they should be both in pristine state. If they are not defined, then nothing to check.
>>
>>If you want to check if BOTH forms are defined and not $dirty then it should be AND not OR:
>>
>>if( (this.form && !this.form.$dirty) &&
>>    (this.parentForm && !this.parentForm.$dirty))
>>...
>>
>
>I think this will be still wrong. Let's get rid of ! $dirty and use $pristine for simplicity. What if the parent form is not defined? What my expression will evaluate to in this case?

false if you use AND and if you use OR it will depend of if this.form is defined and what is the value of $pristine.
I don't know what you try to achieve here.
When you want the code inside to if()to be executed?
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform