Hi Peter,
The idea you have is sound. You are not the first one going down this road.
However, this approach turns out to be problematic for a number of
reasons, and you will encounter new edge-cases all the time.
However, not all is lost, there are way's to do what you want and depending
on your use-case one of the 2 following solutions might be the answer:
1: wrap the input in a componentt, and use @contentChild to get a reference
to your input. your template will look like this:
<bootstrap-input>
<input class="form-control" [type]="type" [placeholder]="placeholder" [(
ngModel)]="value" [disabled]="isDisabled" (blur)="touched()"/>
</bootstrap-input>
This is the simplest way. use ngContent to project the input inside of all
the layout you need.
2. Create a directive that does something similar:
<input bootstrap-input class="form-control" [type]="type" [placeholder]=
"placeholder" [(ngModel)]="value" [disabled]="isDisabled" (blur)="touched()"
/>
This is my favourite, but a tad harder to implement.
This way, you don't have to move all the moving parts around and don't have
to hump trough any hoops anymore. Your solution only needs to monitor the
existing handling on the input, and update the relevant stuff in its own
view.
Regards
Sander
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.