Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conditional expressions without operators don't work properly (linq.ts BUG) #519

Open
jure123 opened this issue Sep 19, 2021 · 3 comments
Open

Comments

@jure123
Copy link

jure123 commented Sep 19, 2021

I found that linq.ts -> expressionParser() function has a bug with boolean expressions that don't use operators.

This conditional expression in @disable decorator does not work propery:

@disable({conditionalExpression: function () { return this.isChecked; }})
--> In this case linq espressionParser() extracts colum name "isChecked;" with included semicolon at the end which does not work

But it works if we put "== true" to the right side of the expression:
@disable({conditionalExpression: function () { return this.isChecked == true; }})
--> In this case linq espressionParser() extracts colum name "isChecked" (without semicolon which if correct of course)

You can try my example on stackblitz (clicking the button should toogle disable of textbox, but it does not work unless you append "== true" to the conditional expression:

https://stackblitz.com/edit/angular-z5p584?file=src%2Fapp%2Fuser.model.ts

BTW: The example below also does not work:
@disable({conditionalExpression: function () { return this.isChecked }})

I have removed the semicolon at the end of expression but the linq parsers still extracts column name "isChecked;" with semicolon (probably somewhere the code automatically adds semicolon to the end of expression)

@rxweb/reactive-form-validators 2.1.4

@ajayojha
Copy link
Member

@jure123 Thanks for reporting this. This is a known issue and we have mentioned a note in most of the conditional expression example documentation, but missed on the disabled example.
Here is the note, like:
image

I keep this ticket in the open state, but no chance to fix this soon, as we have the alternative to work with conditional expression :).

@jure123
Copy link
Author

jure123 commented Sep 20, 2021

@ajayojha, thanks for your info. Indeed it is no big deal because we have a simple workaround :)

@timrasche
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants