【发布时间】:2017-09-02 14:20:22
【问题描述】:
我是 webapi 和 angular 的新手,找不到合适的解决方案,请帮助我,如果可以的话,请建议我一些好的资源来了解这个主题。
productResource.js 文件:
(function () {
"use strict";
angular.module('Random')
.factory('productResource', function ($resource) {
return $resource("http://localhost:60208/");
});
});
T.js 文件
var app = angular.module("JobsApp", []);
app.controller("JobController", function($scope,$http,productResource)
{
$scope.Jobs = productResource.query();
});
Index.cshtml 文件:
<div ng-app="JobsApp">
<div ng-controller="JobController">
<table class="table">
<tr>
<th>Job Id</th>
<th>Description</th>
<th>Minimum</th>
<th>Maximum</th>
</tr>
<tr ng-repeat="j in Jobs">
<td>{{j.job_id}}</td>
<td>{{j.job_desc}}</td>
<td>{{j.min_lvl}}</td>
<td>{{j.max_lvl}}</td>
</tr>
</table>
</div>
</div>
【问题讨论】:
-
这不是 Angular 2 的问题,请移除标签。
标签: asp.net angularjs asp.net-mvc asp.net-web-api