返回显示本机代码错误响应的JSON数据的问题

时间:2016-07-07 10:47:32

标签: javascript jquery angularjs json model-view-controller

ANGULAR JS

 var App = angular.module('myApp', [])

    App.controller('mainController', function ($scope, $http) {

    $http.get("/Project/getProjects")
        .success(function (result) {
            $scope.SuccMsg = "SUCCESS.. ";
            $scope.projectList = result;
        })
        .error(function (Data) {
            $scope.ErrMsg = "ERROR.. " + Error;
        })   })

CONRTOLLER:PROJECT

        public  JsonResult getProjects()
        {             
            List<Project> p2 = new List<Project>();
            p2 = db.Projects.ToList();
            return Json(p2,JsonRequestBehavior.AllowGet); 
        }

HTML文件         

项目

<div ng-controller="mainController">
    @*LIST PROJECT*@
    <table id="tbl_Project" class="table-striped">
        <tr ng-repeat="item in projectList">
            <td>{{item.p_name}}</td>
            <td>@*DELETE PROJECT*@
                <input id="btn_delete" ng-click="deleteProject(item)" value="X" type="button" />
            </td>
        </tr>
    </table>
    <br /><br />
    <div style="color:firebrick"><b>{{ErrMsg}}</b></div>
    <div style="color:forestgreen"><b>{{SuccMsg}}</b></div> </div>

0 个答案:

没有答案