Angular and HTML - I cannot show database information in HTML

Asked

Viewed 116 times

0

I would like to show the database information, is pulling the information correctly,and it is shown in the console that there is an array of 35 items to be shown but I am not able to display them in html.

<div ng-app="Chamados" ng-controller="Chamando">

    <table>
        <tr ng-repeat="chamado in CHAMADOS">
            <td>{{chamado.STATUS}}</td>
        </tr>
    </table>

<script>
var app = angular.module("Chamados", []);
app.controller("Chamando", function($scope, $http) {
    $http.get('caminhodoBanco'/*, JSON.stringify(data)*/).then(function (response) {
        $scope.chamados = response.data.records;
    }, function (response) {

    });

});

</script>
  • This in high box CHAMADOS instead of low, as is on the line $scope.chamados but you could edit your question and really explain your difficulty, because this vacancy, can not know exactly your problem.

  • Still hasn’t changed in nadakkk

  • See what’s returning on Console, you are trying to return the information directly from Database ?

  • {CALLS: Array(35)}

  • it can take the database information, but I can’t display it in html

  • Below the line $scope.chamados = makes a console.log($scope.chamados);

  • did not show any change

  • Actually we want to know what’s the exit from console.log, will not present any difference @Thiagoluizferreiratavares. You can show us what was the exit, or the exit response.data.records?

  • {CALLED: Array(35)} CALLED : (35) [{... }, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}, {…}]&#xA;proto : Object

  • Try this @Thiagoluizferreiratavares: $scope.chamados = response.data.records.CHAMADOS;

  • Tried and gave this on the console @Lucas Costa

  • Typeerror: Cannot read Property 'CHAMADOS' of Undefined at historico:66 at angular.js:16832 at m.$Digest (angular.js:17971) at m.$apply (angular.js:18269) at l (angular.js:12387) at Xmlhttprequest.A.onload (angular.js:12541) "Possibly unhandled rejection: {}"

Show 7 more comments
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.