Zul K Zul K - 27 days ago 10
iOS Question

how to display Array Value using ng-repeat in ionic

I am new in ionic and app development.
here is my code
app.js

.controller("MainCtrl",function($scope){
$scope.Users = [{
name:"abdulla",
city:"Korutla"
},{
name:"zulqarnain",
city:"Hyderabad"
},{
name:"Hameen",
city:"Karimnager"
},{
name:"yasir",
city:"hyd"
}];
})


index.html

<ion-content class="has-subheader">

<ul>
<li ng-repeat="user in Users">
{{Users.name}}
</li>
</ul>
</ion-content>


why it doesn't show me output

Answer

Change the name of the variable Users to user

<ion-content class="has-subheader">
          <ul>
            <li ng-repeat="user in Users">
              {{user.name}}
            </li>
          </ul>
</ion-content>