I am looking for a way to extend or wrap a third-party directives html with Angular 1.5.
Given a directive
<lib-input></lib-input> I want to create a directive <my-lib-input> which renders the following HTML:
<div> <my-directive></my-directive> <lib-input ng-if="vodoo()"></lib-input> </div> Which is supposed to be used in the same way as the original directive.
Example
To use my directive in the same way as the original, i need to move all attributes to a specific node of my template:
<my-lib-input ng-model="model" ng-change="ctrl.onChange()"></my-lib-input> should generate:
<div> <my-directive></my-directive> <lib-input ng-if="vodoo()" ng-model="model" ng-change="ctrl.onChange()"></lib-input> </div> However angular applies all the attributes to the root-node (here: the div) by default.
Question
How do I apply all parameters/ attributes which are passed to my directive to a specific node of the template?
I would like to prevent hardcoding a list of available parameters in my directive like:
restrict: 'E', scope : { ngModel: '=', ngChange: '&', ... }