Do I have to create a directive for each type of user input


I am creating a greenfield application in Angular. I was wondering what to do with the userinput. I will create 10+ date inputs, 20 text inputs, 8 dropdowns, 30 buttons, 10+ currency input etc., all with validation.

With my background as a .NET developer I am used to have a lot of html for each control (html control, lots of bootstrap, validation line), duplicated throughout all the html.

Now in Angular there are directives.

Should I create a directive for each type of user input?

And with 'should I' I mean in a pragmatic way (because it's very handy) and/or a architectual way (because it is better architectual).

The second reason I ask is because I find the directives syntax one of the more difficult parts to learn.

In my opinion you should not create any directive for inputs / selects. Html code for inputs and selects is to short and easy, so directive will not help you at all. Instead of use on inputs build in angular directives Lets look:

<input ng-model=""
  ng-pattern="for email format"

for select you can use also ng-options for validation purpose you ca use something like that:

ng-class="{'has-error': !joinForm.password.$valid && !joinForm.password.$pristine }"

So I think custom directives will only complicate your work