Angular Forms Tutorial - 10 - Select control validation

preview_player
Показать описание

📱 Follow Codevolution

Angular | Angular Forms | Angular Forms Tutorial | Template Driven Forms | Select control validation
Рекомендации по теме
Комментарии
Автор

Instead of making two functions to validate the select form, you can just make the default value empty ("") and the validation will be fine.

mohamedelhamra
Автор

Instead of writing separate method for validating for topic we can do this, no?
by using template reference variable we can use default value as blank and check it out in if condition if
the selected option has value blank it means it is default otherwise topic is selected, and it works for me
<div *ngIf="topic.invalid && topic.touched">
<small *ngIf='topic.value==""' class="text-danger">Choose the topic</small>
</div>

sarcastic_quote
Автор

why someone will choose default option ?? it should be just for showcase not for any use ... that default option doesnot take any input from keys or click .. simple is that ?

BhaveshSinghBhanucsgo
Автор

I must say your videos has saved a lot stress. However, I tried using *ngFor directive with radio buttons and no values was checked by default even when the default value was set from the model property. If it is possible, do a video for radio buttons using * ngFor directive

profonyilo
Автор

for me on reloading the page there does not show anything selected by default, its just blank

ravisachdeva
Автор

Hi ! Sir
is <small || topic.touched">Faire une choix</small> not <small || topic.untouched">Faire une choix</small>

ericcreahi
Автор

everything did like in the video but i had error like
" Export of name 'ngModel' not found! "

sivagurunathansivaperuman
Автор

Great Bro!
where can we find the source code

jeevankali_
Автор

someone can be interested in all three- angular, react, vue. It should be check box options :).. just kidding.

dr.shreyas
Автор

validateTopic(value: string){
if(value === 'default')
this.topicHasError=true;
else {
this.topicHasError=false;
}
}

shefalipatel