Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
in Angularjs JSON is returned but not displayed in table

the code below, creates a table of data and works OK.

******************* works OK**************************

//angularjs to fetch JSON data for table

var app = angular.module('myApp', []);
app.controller('customersCtrl', function($scope, $http) {
$http.get("http://test2.aspx")
.then(function (response) {$scope.recds = response.data.records;

********************************************************

I want to click on a table line and dynamically create a second table with charge data. The code below returns a correct JSON file, which is displayed in the alarm, but does not display in the generated html.....the table is created but the angularjs JSON placeholders are just displayed: eg { x.Charges }.

Does anybody have any ideas why please?

//angularjs to fetch JSON data for charges
    $scope.go=function(x) {
        
        
            
                $http.get("http:///Charges.aspx?ac=" + x)
                .then(function (response) {$scope.chgs = response.data;
                
                alert(JSON.stringify($scope.chgs.records2));

*********************** Doesn't work************************************                    
                var lines='<table>';
                lines +='<tr>';
                lines +='<th>Account</th>';
                lines +='<th>Chargecode</th>';
                lines +='<th>Rate</th>';
                lines +='</tr>';
                lines +='<tr ng-repeat="x in chgs">';
                lines +='<td>{{ x.Customer }}</td>';
                lines +='<td>{{ x.ChargeCode }}</td>';
                lines +='<td>{{ x.Charge }}</td>';
                lines +='</tr>';
                lines +='</table>';
                document.getElementById("div1").innerHTML=lines;
                document.getElementById("div1").style.visibility = 'visible';
                //})
                })  
                        
    }
************************************************************************************
})
})

Many Thanks

Rob

sample charge JSON file

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!