mydirective is an isolated scope directive. This is because I don't want to expose all the logical of the directive to anywhere outside of the directive. But I want to access the input data, outside of the directive.
<div mydirective>
<input ng-model="data.input">
</div>
<div mydirective>
<input ng-model="otherdata.public">
<input ng-model="more.than.one">
</div>
{{data.input}}
{{otherdata.public}}
I prefer that the HTML will work without changing it , and change ONLY the directive code. So I want to know how to create the directive
app.directive('mydirective',function(){ return {
scope:true,
controller:function($scope){
$scope.this_variable_needs_to_be_private=true
},
transclude:true
}})
EDIT: add transclude:true. But still I have no answer for the question.