2021年3月19日星期五

Why form validation errors are not showing in Angular?

I have been working for a week in a project, recently I notice I don't get any form validation errors, and I don't know why.

I tried with this code, from https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation

<form>   <div>     <label for="choose">Would you prefer a banana or a cherry?</label>     <input type="text" id="choose" name="i_like" required minlength="6" maxlength="6">   </div>   <div>     <label for="number">How many would you like?</label>     <input type="number" id="number" name="amount" value="1" min="1" max="10">   </div>   <div>     <button>Submit</button>   </div>  </form>  

I replace my entire app.component.html with the code and the validation message was not showing, then I replace index.html body and it works, I don't know what could be the problem in my project.

I also tried to remove boostrap and any dependency in my angular.json scripts, styles and assets from the project but still not showing.

https://stackoverflow.com/questions/66717355/why-form-validation-errors-are-not-showing-in-angular March 20, 2021 at 09:07AM

没有评论:

发表评论