【发布时间】:2019-06-15 02:24:00
【问题描述】:
我正在使用 AngularJS,但无法使用 Angular 的 ng-repeat 填充 index.view 中的数据。
我会留下代码 sn-p 以获得任何帮助。
记住,我有http 200请求的状态ok,只是当我连接屏幕上的数据时,我无法填写。
registerController.js
angular.module('Application').controller('registerController',
function($scope,
$http, registerService) {
$scope.registerUser = {};
$scope.GetAllRegisters = function () {
var registerServiceCall = registerService.GetRegisters();
registerServiceCall.then(function (results) {
$scope.registers = results.data;
}, function (error) {
$log.error('ERRO');
});
};
$scope.GetAllRegisters();
});
我的服务.js
angular.module('Application').factory('registerService', function ($http) {
return {
GetRegisters: function () {
return $http({
method: 'Get',
url: "http://localhost:51734/api/UserAPI"
})
},
};
});
还有我的 index.html
<div class="row" style="">
<table class="table table-striped" style="">
<tbody>
<tr>
<th style="display:none">Id</th>
<th>Nome</th>
<th>Sobrenome</th>
<th>Ativo</th>
<th>Email</th>
<th>Editar</th>
<th>Remover</th>
</tr>
<tr ng-repeat="registerUser in registers" style="word-wrap: break-word;">
<td style="display:none">{{registerUser.UserId}}</td>
<td>{{registerUser.Name}}</td>
<td>{{registerUser.LastName}}</td>
<td><input type="checkbox" ng-model="registerUser.IsActive" disabled /></td>
<td>{{registerUser.Email}}</td>
<td>
<a href="" ng-click="" class="glyphicon glyphicon-edit"></a>
<td>
<a href="" ng-click="" class="glyphicon glyphicon-trash"></a>
</td>
</tr>
</tbody>
</table>
任何帮助或建议将不胜感激。谢谢
【问题讨论】:
标签: c# .net angularjs asp.net-web-api asp.net-core-2.0