1

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/

1 Answer 1

2

Change var to $scope,

 var userList= [...];

to

$scope.userList = [...];

WORKING FIDDLE

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.