I'm curious why the control must lose focus once in order for any of these error conditions to be true. In other words, if I reload the form, then click in the loan name box, it seems to me that the required and minlength errors should immediately be true, and of course once I exceed the max length, maxlength will be true. However none of these ngIf'd s will appear until the text box has lost focus at least once. After that, if I return to the text box, each of the error conditions are reflected immediately as they become true. I guess that's a more user-friendly way to handle it -- I don't want to be preached to about a field being required when I've just placed my cursor in it for the first time, but I'm wondering why there is that subtle difference.
Hello sir.. First Of all thank you so much for this amazing series. And I just noticed that I think part-55, that is about template driven form's is missing from playlist.... Can you please check and upload that part. Thank you. .....
Hi Nicely explain but just one thing to highlight that it seems syntax has changed. I tried with mentioned syntax but it didn't work for me. *ngIf="addLoadTypeForm.get('loanName').hasError('required') && addLoadTypeForm.get('loanName').touched" Syntax which worked for me is pasted below *ngIf="addLoadTypeForm.controls['loanName'].errors?.required && addLoadTypeForm.controls['loanName'].touched"
Hi, I have added "strictNullChecks" : false in my tsconfig.json and separated these 2 ngIf conditions in different parantheses, as there was an errror - "object is possibly 'NULL'" while writing the hasError(). Would like to know if manipulating the tsconfig.json for these bug fixes while working for a real time project is a good practice or not.
Hi sir i am getting error can you help me out this Enter LoanName Error: src/app/admin/admin.component.html:9:80 - error TS2531: Object is possibly 'null'. it showing red mark at hasError
Hello All, I fixed the issue by changing the syntax and my version is 12. Loan Name is Required Loan Name must have minimum 10 characters Please try this, it may help who facing this hasError issue. Thanks
11:13 That's a bad DX (developer experience). Instead, you should use the invert and do an early exit for a cleaner code, i.e. if (this.addLoanTypesForm.invalid) { return; } // rest of code
I'm curious why the control must lose focus once in order for any of these error conditions to be true. In other words, if I reload the form, then click in the loan name box, it seems to me that the required and minlength errors should immediately be true, and of course once I exceed the max length, maxlength will be true. However none of these ngIf'd s will appear until the text box has lost focus at least once. After that, if I return to the text box, each of the error conditions are reflected immediately as they become true. I guess that's a more user-friendly way to handle it -- I don't want to be preached to about a field being required when I've just placed my cursor in it for the first time, but I'm wondering why there is that subtle difference.
This tutorial series is absolutely the best Angular content available for free..
Thanks Sir, Its really helpful.
Keep Up the good work.
You are most welcome. Thank you so much for your kind words
Perfect tutorial to get good hands on in Angular. Thank you Sridhar for explaining step by step very clearly and it is really easy to understand.
Best Angular Tutorial on youtube!
Thanks mate for your support!
very easy to learn and follow you sir, please keep uploading like this series
Thank you, I will
Hi sir, I am getting an error (object is possibly 'NULL') while displaying an error message in reactive forms(65)
please respond to this...im having the same error
@@saketkumar9291 Hello,
you can try the below
Loan Name is Required
Loan Name must have minimum 10 characters
Thanks
@SRIKANTH P Glad to know your issue resolved 🙂
@@amarnath602 !.hasError('required') add the " ! " excclamation mark before the obj.. which is the on-null assertion operator
Open tsconfig.json and add "strictNullChecks": false to angularCompilerOptions
Try to make video on dynamic forms also it was asked in one of my interview
Thats coming right up tomorrow 👍👍
Hello Sir Awesome teaching style and nice explanation I have never seen this teaching style could you please create react js videos in depth
Hello sir.. First Of all thank you so much for this amazing series. And
I just noticed that I think part-55, that is about template driven form's is missing from playlist.... Can you please check and upload that part. Thank you. .....
Thanks buddy for the tip. I have now added it to the playlist. Thanks for your kind support
Thank you sir..... Always.
I don't know why but as I am using *ngIf it shows an error that is
Error occurs in the template of component LoanTypesComponent.
thank you..Sridhar ..
Thank you so much Ahmad for your support
Hi Nicely explain but just one thing to highlight that it seems syntax has changed. I tried with mentioned syntax but it didn't work for me.
*ngIf="addLoadTypeForm.get('loanName').hasError('required') && addLoadTypeForm.get('loanName').touched"
Syntax which worked for me is pasted below
*ngIf="addLoadTypeForm.controls['loanName'].errors?.required && addLoadTypeForm.controls['loanName'].touched"
Hi, I have added "strictNullChecks" : false in my tsconfig.json and separated these 2 ngIf conditions in different parantheses, as there was an errror - "object is possibly 'NULL'" while writing the hasError(). Would like to know if manipulating the tsconfig.json for these bug fixes while working for a real time project is a good practice or not.
!.hasError('required') add the " ! " excclamation mark before the obj.. which is the on-null assertion operator
@@SURIYA-pp4iu tqq soo much ... u saved me.
@@sudha.i4593 😋😋
i got error for required but not getting any error for minlength and maxlength.. plzz help me
very good
Thank you! Cheers!
Hi sir
i am getting error can you help me out this
Enter LoanName
Error: src/app/admin/admin.component.html:9:80 - error TS2531: Object is possibly 'null'.
it showing red mark at hasError
i am too facing the same problem
@@sureshpalthiya3204 You can try this
Loan Name is Required
Loan Name must have minimum 10 characters
Thanks
@@amarnath602 yeah thanks buddy it worked
!.hasError('required') add the " ! " excclamation mark before the obj.. which is the on-null assertion operator
Open tsconfig.json and add "strictNullChecks": false to angularCompilerOptions
It's showing red underlined below required and touched
Sir it's showing error with required and touched and hasError
i don't know why but minLength dosen't work but required is working
had the same issue, try to type "minlength" instead of "minLength", this worked for me
Dirty and pristine not cleared
Sir I want your help in project. Can you please tell how can I contact you
Hi Shruti. Pls write to me at soorya.aaradhya@gmail.com
Hello All,
I fixed the issue by changing the syntax and my version is 12.
Loan Name is Required
Loan Name must have minimum 10 characters
Please try this, it may help who facing this hasError issue.
Thanks
11:13 That's a bad DX (developer experience). Instead, you should use the invert and do an early exit for a cleaner code, i.e.
if (this.addLoanTypesForm.invalid) {
return;
}
// rest of code
I believe there is a sytax change while displaying error message and I have resolved that as
follows: FirstName is Required