Answer the question
In order to leave comments, you need to log in
How to display data through controller in AngularJS?
Here is the code from the controller
angular.module('erp7App')
.controller('ClientsBrowserCtrl', function ($scope, api) {
api.clients.allCompany("", function($scope, response) {
console.log(response.data);
$scope.clientsCompany = response.data;
});
});
Answer the question
In order to leave comments, you need to log in
Most likely you have an error in calling api.clients.allCompany.
Judging by the code, this function passes some data to the first argument of the callback, but the fact that this first argument is $scope is very unlikely.
Try to replace
api.clients.allCompany("", function($scope, response) {
console.log(response.data);
$scope.clientsCompany = response.data;
});
api.clients.allCompany("", function(_, response) {
console.log(response.data);
$scope.clientsCompany = response.data;
});
and outputs response.data to the console?
There is what?
and if
$scope.clientsCompany = JSON.parse(response.data);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question