0
Good Friends! I am working on a MVC application that returns JSON to an Angularjs controller, it turns out that these values are unit values and lists. And when rendering in the view, only unit values work. Values that are a list render a list of empty fields. Remember that all data is being loaded correctly in the Angularjs controller.
Angular.
var app = angular.module('FileApp', []);
app.service('ngFileService', function ($http) {
this.getFileByFileCode = function (fileCodigo) {
var response = $http.get("/Files/GetFile?fileCodigo=" + fileCodigo);
return response;
};
});
app.controller('ngFileController', function ($scope, ngFileService) {
$scope.filterFileCode = "";
$scope.getFilteredFile = function () {
var promise = ngFileService.getFileByFileCode($scope.filterFileCode);
promise.then(function (resp) {
$scope.File = resp.data;
$scope.Message = "Call is Completed Successfully";
}, function (err) {
$scope.Message = "Call Failed " + err.status;
});
};
});
HTML
<tr>
<td>Enter Search Value:</td>
<td><input type="text" ng-model="filterFileCode" class="form-
control" ng-change="getFilteredFile()" /></td>
</tr>
<table class="table table-bordered table-condensed table-striped">
<thead>
<tr>
<th>Documentos Gerais File</th>
<th></th>
<th>CTB</th>
<th>COM</th>
<th>Site</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="f in File">
<td>Documentos</td>
<td>{{f.FileCTB}}</td>
<td>{{f.FileCOM}}</td>
<td>{{f.FileSite}}</td>
</tr>
</tbody>
</table>
Here are some print: Debug Front-end Empty list
Dating: "/Date(-62135596800000)/" Date end: "06/07/2018" Starting date: "06/26/2018" Descricaoservico: null Filecom: (2) [true, false] Filectb: (2) [false, false] Filecodigo: 190562 Filecode: 0 Filecodigonv: null Filemimetype: null Filesite: (2) [false, false]
present the generated in your question
– Leandro Angelo