Passing angular variable value in js from sightly
Hi,
I have a angular variable {{example.variable}} which is coming from angular controller.
{{example.variable}} has a value(4 digit code) - 1001
I wanted to do something like below(passing the angular variable from sightly to javascript file):
<div data-sly-use.data="${'example.js' @fieldName = '{{example.variable}}' }"/>
In example.js file:::::
var abc = this.fieldName; (reading the property from html file)
out.println(abc) //Result is 1001
out.println(abc.length) //Result is 17(Surprised. Was expecting 4)
I printed the abc character by character then and the result came as "{{example.variable}}" and not the value inside the angular variable(i.e 1001).
Please let me know if there is any way to pass the dynamic value of angular variable.
Thanks
Akshita