Divide a string into JSON and use them in two separate tds with angular

advertisements

So I'm calling a JSON string, and I want to split it in two at the ":" and use the two values to show in two separate td tags.

function testCtrl($scope) {
$scope.response = {"name":["The name field is required."],"param":["Hobby: Coding", "Country: USA"]};}

to visualize a little more at what I'm trying to do http://jsfiddle.net/8mnxLzc1/5/


You could try this:

<table>
    <tr ng-repeat="resp in response.param">
        <td ng-repeat="val in resp.split(':')">{{ val }}</td>
    </tr>
</table>

Fiddle