javascript - How to pass evaluated values to a custom element directive? -
i have custom element directive following template:
<div> <input value="{{datafromrootscope}}" /> </div>
and definition:
dirmodule.directive('mydirective', function() { return { restrict: 'e', templateurl: '/scripts/app/directives/mydirective.html' }; } );
i use directive shown below:
<my-directive my-value="{{datafromscope}}"></my-directive>
i.e. want use evaluated datafromscope
value inside custom directive datafromrootscope
. how can reach this?
you can use '@' sign :
dirmodule.directive('mydirective', function() { return { scope: { myvalue: '@' }, restrict: 'e', templateurl: '/scripts/app/directives/mydirective.html' }; });
the '@' sign binds evaluated value of dom attribute directive.
you can use directive asked :
<my-directive my-value="{{datafromscope}}"></my-directive>
Comments
Post a Comment