Reputation: 1117
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
Reputation: 222522
Change var to $scope,
var userList= [...];
to
$scope.userList = [...];
Upvotes: 2