Skip to content Skip to sidebar Skip to footer

Json Parser Doesn't Work With Angular Ng-repeat

I am trying to access json obj and set values into Angular Ui-grid.But the problem was that some of my json obj fields are json string.I tried to convert that fields into json obt

Solution 1:

Create a method in scope

$scope.parseJSON=function(strObj){
  returnJSON.parse(strObj);
}

Then call from template

var testPlantemplate ='<div><ul><ling-repeat="testPlans in parseJSON(row.entity.JobDetails)">{{testPlans.environment}}</li></ul></div>';

JSFIDDLE

Solution 2:

can you try with stringify() then it escapes all of "/"...

    var testPlantemplate ='<div><ul><ling-repeat="testPlans in JSON.stringify(row.entity.JobDetails)">{{testPlans.environment}}</li></ul></div>';

check this link...

http://speakingjs.com/es5/ch22.html

Post a Comment for "Json Parser Doesn't Work With Angular Ng-repeat"