Pintac
Pintac

Reputation: 1585

Error handling in custom directive

I am currently build a set of directives that we will be shipping to customer to use.

Now some of the directives has got required parameter and also some validation on parameters.

Is there some sort of guideline to what a person must do if a required field is not there or a validation failed.

Must you default values,throw exception, or use angularjs exception handling thing.

thanks

Upvotes: 0

Views: 657

Answers (1)

harishr
harishr

Reputation: 18065

you are the one who has written a directive, you must be the one who should answer these questions...

guideline to what a person must do if a required field is not there or a validation failed.

only thing you can help with is making sure that if some required parameters are missing, is give some indication user of the directive, either by some exception logging or console messages etc.

its exactly like how angular tells us how to use ng-change or ng-click for that matter.

Upvotes: 1

Related Questions