所以我开始了解angularJS今天,我也创建了一个演示代码。 不知何故代码没有运行。我从某处复制此代码并更改为我的名字。运行后的HTML。代码显示{{CU.name}}
可以通过角度Js和MVC逐步提取数据来给出一个好的链接或简单的示例代码?AngularJS与MVC控制器指南需要
<script>
var TestCtrl = function ($scope, $http) {
$scope.firstCall = function() {
$http({
url: "@Url.Action("RetriveRecordList", "recordController")",
dataType: 'json',
method: 'GET',
data: '',
headers: {
"Content-Type": "application/json"
}
}).success(function (response) {
debugger;
alert("haha")
$scope.DemoList = response;
})
.error(function (error) {
alert(error);
});
}
}
<div ng-controller="TestCtrl" ng-init="firstCall()">
<div class="table-responsive com-table">
<table class="table table-bordered table-hover table-striped">
<thead>
<tr>
<th width="5%">Customer ID</th>
<th width="15%">Customer Name</th>
<th width="15%">Email</th>
<th width="20%">Mobile No.</th>
<th width="25%">Address</th>
<th width="20%">Registration Date</th>
</tr>
</thead>
<tbody>
<tr ng-repeat="CU in DemoList">
<td width="5%">{{CU.name}}</td>
<td width="15%">{{CU.name}}</td>
<td width="15%">{{CU.name}}</td>
<td width="20%">{{CU.name}}</td>
<td width="25%">{{CU.name}}</td>
<td width="20%">{{CU.name}}</td>
</tr>
</tbody>
</table>
<div class="collapse">
<div class="well">
</div>
</div>
</div>
</div>
所以是必须的,以限定NG-应用?[链接] http://www.c-sharpcorner.com/UploadFile/cd7c2e/show-data-in-grid-format-using-angularjs-and-web-api/这个链接的例子还没有ng-app也是 –
是的角度应用程序必须具有模块,并使用html进行引用ng-app指令 – kamprasad