Comments (11)
@simfyz to answer your question. I simply added a subscription to the value change for the formControl (in this example "firstName") and then added a required validator to the formControls that should be required conditionally.
from rxweb.
@ajayojha Thanks for the headsup. I found that it's not imported in the root module, rather to shared module and imported along the feature modules. I think after the changes as you mentioned, it is working as I found, now it is passed to the QAs to be verified. I will update if I find any issues here on.
I'm interested to see what @hoermillerj 's findings.
from rxweb.
@ajayojha is there any updates on this issue? I'm having the same issue.
@hoermillerj did you find a workaround on this?
from rxweb.
I did check in the past but forgot to update here, Please refer to this link, I think it's working as expected
from rxweb.
I did check in the past but forgot to update here, Please refer to this link, I think it's working as expected
@ajayojha I think this has a conflict of API or issue with IVY. In youe example, it is version ANgular v 7. Please refer the example StackBlitz by @hoermillerj , it's Angular 7 and has the issue. I'm also on v13.
from rxweb.
@ajayojha I checked your gist and it seems like you are using an older version of Angular as @simfyz pointed out. I created a new version of my StackBlitz link here to incorporate your style (here), but unfortunately the results are the same. The required validator only takes effect after the value of "middleName" or "lastName" has been changed and then removed again.
from rxweb.
@hoermillerj & @simfyz thanks for pointing it out. I will look into this and fix it soon.
from rxweb.
@simfyz to answer your question. I simply added a subscription to the value change for the formControl (in this example "firstName") and then added a required validator to the formControls that should be required conditionally.
Thanks. I did write my own custom validator to achieve this. Not the cleanest way. I will wait till a fix from @ajayojha
from rxweb.
@hoermillerj I have checked the shared stackblitz link and identified the cause of this issue. It's not related to lib, You have missed importing the RxReactiveFormsModule
in the root module. that's the reason conditional validation is not working. Please refer to this updated code example.
Here is the changed code snippet:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { RxReactiveFormsModule } from '@rxweb/reactive-form-validators';
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule,
ReactiveFormsModule,
RxReactiveFormsModule,
],
declarations: [AppComponent],
bootstrap: [AppComponent],
})
export class AppModule {}
@simfyz Please check in your project whether the RxReactiveFormsModule
is imported or not.
I am not closing this ticket until getting the green signal from you guys (@hoermillerj & @simfyz ) :).
from rxweb.
@ajayojha Looks like the issue is still persisting. I have check box inside the form array. if the check box value is true, another value is required. The conditonalExpression is firing only at the initalization. After that it fires when the checkbox is checked. When unchecked it's not firing the conditional expression. I did import in the root module.
from rxweb.
@simfyz Please share the stackblitz URL of the issue example.
from rxweb.
Related Issues (20)
- Trying to access unsupported language by URL HOT 1
- Min or Max Length Issue HOT 1
- Warning about usage of options and async validators
- conditionalExpression for greaterThan hits twice on input change with old value
- Angular Universal
- Select dropdown value issue with Rx-Select.
- Movable columns & rows in Rx-Grid
- minTime and maxTime issues HOT 4
- RxwebValidators.numeric with isFormat: true makes values disappear from input HOT 1
- https://docs.rxweb.io/ is blank.
- Compatibility with Angular 15/16 HOT 1
- Please confirm the right way to clear RXwebvalidator and reset it
- @rxweb/types taking too much compile time
- conditionalExpression with OnPush causes a shift of validity by 1
- Add an array of strings to a form using RxFormBuilder
- Validation of ISO 8601 dates HOT 1
- Default "max" or "min" values? HOT 1
- How to get inferred types for nested form group
- Angular 17: Cannot read properties of undefined (reading 'properties'). Project dead?
- Help with RxwebValidators.custom and RxwebValidators.customAsync
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rxweb.