Need to load a Json in a table through ng-repeat


I am using angularjs with grunt.I am a beginner

Have a table in html file.

<tr ng-repeat="project in PTList">

Through WCF i have the Json.

var promise = PTdata.getPTdata();


this.gePTdata = function()
		var deferred = $q.defer();
		var promise = this.LoadProject(); //Here I get the JSON
		promise.then(function(data) {					
				PTDataFromDB = data.userDetails; // Have the values in PTDataFromDB 					
		return deferred.promise;

This is what I have. I need to assign the JSON value in “PTDataFromDB” to “PTList” in the html page. I am trying this but not able too.


Can you post enough code that we can recreate your problem.
You can stub out the promise variable with whatever the LoadProject function should return.

Hi Pullo,

The LoadProject function works fine and get the JSON value. Even though will post it.

this.LoadProject = function () {
		var deferred = $q.defer();			
				method: 'POST',						
				url : "http://localhost-url",					
				dataType: "json",
				processData: true,
				headers: {'X-API-KEY': PTid()}//PTid is the Id send as parameter x-api-key
			}).success(function(data) {
			 }).error(function(msg, code) {
				// This will happen if this is a server side error.
            	deferred.resolve("Server error while trying to login. Please try again." + "Message : " + msg + "Code : " + code);					
		return deferred.promise;

Need the assign the JSON to the table. So think so need to convert the JSON to array or something. I am not sure. Any idea about it.


If you provide enough code to recreate your problem then I don’t mind having a look.

To give you an idea of what I mean, have a look at this post. Here, I can just copy the code (from index.html) to my PC and run the demo. Something similar would be nice here.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.