I use angularjs (ng-init) and I want to assign value to variable as jsonObj.
I try this one but it doesn't work.
ng-init="percentObj = [{ "value":40,"color":"#F5A623" },{ "value":60,"color":"#F5A623" }];
and another question I want to assign value like
percentObj = [{ "value": parseInt($scope.projectData[0].value),"color":"#F5A623" },{ "value": parseInt($scope.projectData[0].value),"color":"#F5A623" }]
How to fix this problem??
Thx
Escape your quotes...
Try this...
for second one, Please check the code below
Just have a JSON encoded string in some element's attribute and then catch that with Angular.
HTML
AngularJS:
Can be done without jQuery too, then the
.data('config')
part changes.You can use window object for set your json :
view :
controller :