- 1 year ago 68
jQuery Question

Angular js : get data in view file and print in loop

I am getting json data in server response and return that to $scope.questions

I want to access this questions data in step1.html file.


(function () {
"use strict";
var app = angular.module("autoQuote",["ui.router","ngResource"]);

app.config(["$stateProvider","$urlRouterProvider", function($stateProvider,$urlRouterProvider){

.state("step1", {
url : "/",
templateUrl : "easyquote/step1.html",
controller: "questionsCtrl",
.state("step2", {
url : "/step2",
templateUrl : "easyquote/step2.html",
controller: "questionsCtrl",


(function () {
"use strict";


function questionsCtrl($scope,$http,$state) {
$http.get('rc1/getQuestions/' + $
.then(function(response) {
$scope.questions =;


<div ng-controller="autoQuoteCtrl">
<form name="DTOstep1" ng-submit="onSubmit()">
<label>Email: </label><input type="text" name="email" id="email" />

<table ng-repeat="questions in que">
<input type="submit" value="Save" />

code preview can be seen here

Answer Source

Your usage of ng-repeat is the wrong way round. It should be like this:

<table ng-repeat="que in questions">