I have a directive with some form. Usually it is all I need, but sometimes I need to add some more input fields. So I tried to use transclusion for that, but it doesn't work.
I created a plunker to ilustrate that: http://plnkr.co/edit/zNOK3SJFXE1PxsvUvPBQ?p=preview
Directive is a simple form with input field, transclusion and a button to help testing it (not important parts ommitted):
scope: {
},
transclude: 'element',
template:
'<form name="myForm">' +
'<input type="text" ng-model="data.inDirective"></input>' +
'<div ng-transclude></div>' +
'<button ng-click="showData()">show data</button>' +
'</form>'
And here it is used with transclusion:
<form-as-directive>
<input type="text" ng-model="data.inTransclude"></input>
</form-as-directive>
Can I somehow use directive's scope in the transclusion?