bubbles2189 bubbles2189 - 1 month ago 10
reST (reStructuredText) Question

AngularJS get data from webapi and store in table

I created a rest web api and using AngularJS, I want to receive those json data and store them in a table. I am new to AngularJS. I was able to get all the json data but I want to split them up into each row. I am not sure if I am doing to correctly or not but here is my code:


<!DOCTYPE html>
<html ng-app="demoApp">
<meta charset="UTF-8">
<script src="lib/angular.js"></script>
<script src="angularDemo.js"></script>
<div ng-controller="demoController">
<tr ng-repeat=" quiz values">
<td>{{result.id}}</td> <!-- Does not get any value-->
<td>{{result.question}}</td> <!-- Does not get any value-->
<h1>{{result}}</h1> <!-- gets all the json data -->


var app = angular.module("demoApp", []);

app.controller("demoController", function($scope, $http) {
.then(function(response) {
$scope.result = response.data;

Answer Source

Your ng-repeat is not good,

If i understand your array of results is in $scope.result, so you have to do this kind of ng-repeat :

<tr ng-repeat="row in result">