In directive code I have:
scope:{
'rendered':'=',
'x':'='
},
restrict:'A',
link:function (scope, element) {
var x = scope.x
...
in HTML I have
<div my-directive x='02/06'></div>
But in Link function var x = 0.333. How to prevent this evaluation? I need to get my '02/06'.
Thank you in advance
asked Jun 8, 2015 at 17:45
Lagoda Denis
2251 gold badge5 silver badges13 bronze badges
1 Answer 1
Try using @ instead of = for x:
scope:{
'rendered':'=',
'x':'@'
}
...
so that the x attribute will be treated as a string literal instead of being interpreted.
answered Jun 8, 2015 at 17:52
Mouse Reeve
2671 silver badge8 bronze badges
Sign up to request clarification or add additional context in comments.
Comments
lang-js
xwill always be a literal value change thescopepropertyxto a@.