Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use foreach with AngularJS on HTML

How do I use a foreach statment in angular js? My current data is printing out as a json format. I want to make it printed out on new lines.

Html

<p>{{controller.greeting.custinfo}}</p>

 //attempt
<p ng-repeat= >{{controller.greeting.custinfo}}</p>

Output on UI

{"id":null,"biling_address":"null","billing_state":"FL","ip_Addresses":["123:111:2101","","NULL"],name":"jimmmy"}

java output

System.out.println(custinfo);
demo.model.cert@ba1983a

How can I use a foreach statement to display the data in new lines? Rather than a json format.

I know how to do this with thymeleaf,example below

<table th:each="custinfo : ${custinfo}">

  <tr>
        <td ng-show="id" class="padded">id:</td>
        <td ng-show="id" th:text="${custinfo.id}" class="padded"></td>
  </tr>
  //continue down
like image 938
Mike.Chun Avatar asked Sep 01 '25 22:09

Mike.Chun


1 Answers

Just loop thru it:

 <p ng-repeat="(key, value) in controller.greeting.custinfo">{{key}}: {{value}}</p>
like image 177
lin Avatar answered Sep 03 '25 15:09

lin