Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranรฎ)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Persian
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
In this lecture, we're going to talk about validation triggers, the validates can be configured to
validate an input on different events.
If we want, we can go with an aggressive validation tactic for validating inputs.
First, let's understand the default behavior as to when an input is validated.
Validation is performed on one of four occasions.
If the input field emits the change event, validation will be performs.
The change event is emitted whenever an alteration is made to the elements value.
The second occasion is when value changes internally via JavaScript.
It's possible to add the model directive to an input.
If we decide to add the the model directive validate, we'll watch for changes on the property we have
bound to the input.
If a change occurs internally, validation will be triggered.
The third occasion is when the blurr event is emitted.
The blur and change events can sometimes occur at similar times.
The difference between them is the Blur event is fired.
When the user touches an input and moves away.
It doesn't matter if they changed the input.
As long as it was touched, the event will be emitted.
The last occasion is when the form is submitted, all fields will be validated.
Validate allows us to change when an input is validated.
We don't have to stick with the default strategy.
We are going to be working in the validation file, open it in your editor.
We can change the validation trigger on all fields by updating the object we passed into the configure
function.
There are four options we can set to change the default behavior.
Let's run through them one by one at the end of the object.
We're going to add a property called Validate on blurr.
Its value will be true.
They validate on blurr option will tell validate if it should validate a field on the blurr event by
default, this option is set to true.
You can set it to false for a less aggressive behavior.
The next property will add is called validate on change.
Its value will be true.
They validate unchanged option will tell the validate if it should validate a field on the change event,
the default value is true.
Afterward, we have the validate on input option.
We will set this to false.
This option is probably the most aggressive validation trigger, the input event is fired whenever the
input changes, it's different from the change event because it'll fire on every keystroke the moment
the user presses a key if the value is invalid and error will appear immediately.
This option may be appropriate for inputs like passwords, but it's excessive for most input's.
Users don't like to have errors thrown at them immediately.
It's better if we wait until they have finished filling out the field.
However, that's my opinion.
Feel free to turn this on.
The default value for this option is false.
The last validation trigger is called validate on model update.
The default value is true.
This option will tell validate to validate the input whenever the value changes internally through the
fee model directive, a total of four options to change the validation triggers.
We are using the default values because I think the default behavior works fine for our case.
I wanted to show you these options in case you need to change.
The default behavior in the next lecture will continue working on validation.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.