krish
krish

Reputation: 1117

Display json data in a table

I have added json data inside controller directly and I need to display it in a table.

 var app = angular
                    .module("myApp", [])
                    .controller("myCtrl", function ($scope, $http, $timeout) {
                    var userList=[
                    {
                        "name":"John",
                        "age":"22",
                        "dept":"admin"
                    },
                    {
                        "name":"Riya",
                        "age":"21",
                        "dept":"Java"
                    }
                    ];
                    });

How to do it?

Sample code: https://jsfiddle.net/ots8saak/

Upvotes: 1

Views: 42

Answers (1)

Sajeetharan
Sajeetharan

Reputation: 222522

Change var to $scope,

 var userList= [...];

to

$scope.userList = [...];

WORKING FIDDLE

Upvotes: 2

Related Questions