HOW TO BIND MIXED JSON DATA IN ANGULARJS

Ankit Singh

Total Post:341

Points:2389
Posted by  Ankit Singh
 636  View(s)
Ratings:
Rate this:
We want to Bind Mixed Json data  in AngularJS. How to bind this Please tell me.
  1. aditya kumar Patel

    Post:254

    Points:1810
    Re: How to Bind Mixed Json data in AngularJS

    @{

    Layout = null;

    }

    <!DOCTYPE html>

    <html>

    <head>

    <title>Forum</title>

    <meta name="viewport" content="width=device-width" />

    <script src="~/Scripts/jquery-1.9.1.js"></script>

    <script src="~/Scripts/angular.js"></script>

    <script>

    var app = angular.module("myApp", []);

    app.controller('MyCtrl', function ($scope) {

    $scope.alldata = [

    {

    "CompanyName":"Software Pvt Ltd",

    "Employees": ["Johan Kumar", "Anupam Singh", "Surekha Pal", "Maya Koni"],

    "awards": [

    {

    "award": "Gold Partner",

    "year": 2000,

    "by": "Microsoft"

    },

    {

    "award": "Gold Partner",

    "year": 2001,

    "by": "IBM"

    }]

    }];

    });

    </script>

    </head>

    <body ng-app="myApp" ng-controller="MyCtrl">

    <table>

    <tbody ng-repeat="dat in alldata">

    <tr>

    <td colspan="3">{{dat.CompanyName}}</td>

    </tr>

    <tr>

    <td colspan="3" align="center"><span style="font-weight:bold">Employees</span></td>

    </tr>

    <tr ng-repeat="cont in dat.Employees">

    <td colspan="3">{{ cont}}</td>

    </tr>

    <tr>

    <td colspan="3" align="center"><span style="font-weight:bold">Awards</span></td>

    </tr>

    <tr ng-repeat="aw in dat.awards">

    <td>{{ aw.award}}</td>

    <td>{{ aw.year}}</td>

    <td>{{ aw.by}}</td>

    </tr>

    </tbody>

    </table>

    </body>

    </html>

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!