Skip to content Skip to sidebar Skip to footer

How To Consume Json Array In Angularjs?

What i trying to do here is, i want to consume the JSON that i produce using Spring Restful WebService, which is looked like this : [ { 'userid': 1, 'firstName'

Solution 1:

First of all, you have to use latest version of angular. Now, it's 1.4.5 with more performance optimizations and features.

About your question: error in html code. Here's the fixed version

functionHello($scope, $http) {
    $scope.users = [
    {
        "userid": 1,
        "firstName": "kevin",
        "lastName": "buruk",
        "email": "pucuk@ubi.com"
    },
    {
        "userid": 2,
        "firstName": "helm",
        "lastName": "krpuk",
        "email": "helmkrupuk@gmail.com"
    },
    {
        "userid": 3,
        "firstName": "batok",
        "lastName": "kelapa",
        "email": "batokkelapa@gmail.com"
    }
]
}
<scriptsrc="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/angular.min.js"></script><bodyng-app><tableng-controller="Hello"><thead><tr><th>ID</th><th>First Name</th><th>Last Name</th><th>Email</th></tr></thead><tbody><trng-repeat="user in users"><td>{{user.userid}}</td><td>{{user.firstName}}</td><td>{{user.lastName}}</td><td>{{user.email}}</td></tr></tbody></table></body>

As you can see, I fixed it with adding only one html tag!

Post a Comment for "How To Consume Json Array In Angularjs?"