【发布时间】:2016-11-27 19:46:06
【问题描述】:
我正在尝试通过 ajax 获取记录并使用 AngularJS 显示。 但是我的代码甚至没有调用控制器操作。
我正在尝试这段代码..
<div ng-controller="MyCtrl">
<div ng-repeat="result in products">
{{result.ProductName}}
</div>
</div>
阿贾克斯:
function MyCtrl($scope) {
$.ajax({
url: "/Products/Get/",
type: "POST",
success: function (data) {
// Success message
var myApp = angular.module('myApp', []);
$scope.products = data;
},
error: function () {
// Fail message
},
});
}
我正在使用this post 使其工作。
【问题讨论】:
-
你没有控制器
MyCtrl
标签: c# asp.net angularjs asp.net-mvc asp.net-mvc-4