使用带有angularjs

时间:2017-05-28 05:38:17

标签: angularjs twitter-bootstrap

我使用了网上可用的所有可能的依赖项,但无法解决问题。 后端代码使用ASP .NET编写,MVC返回Json数据。

以下是我的控制器代码

var app = angular.module('myTaskFormApp', [])
app.controller('MyTaskController', function ($scope, $http, $location, $window) {
    $scope.TaskModel = {};
    $scope.message = '';
    $scope.result = 'colour-default';
    $scope.isViewLoading = false;
    $scope.List = null;
    $scope.List1 = null;
    var TaskNo = getQueryVariable('TaskNo');
    getallData();



//******=========Get All Resources=========******  

function getallData() {
    debugger;
    $http.get('/Dashboard/GetMyTasks?TaskNo=0').then(function (data, status, headers, config) {
        $scope.List = data.data;
        $('.dataTable-length').dataTable();
        }, function (data, status, headers, config) {
            $scope.errors = [];
            $scope.message = 'Unexpected Error while saving data!!';
            console.log($scope.message);
        });
    };
});

我尝试使用datatable ='ng'即使这样也行不通。 以下是我的HTML代码。 我正在获取数据,但最后我得到了

  

未找到数据

。 当我点击表格对数据进行排序时;所有数据都被清除了。 锚标记也不在链接中。链接永远不会到达控制器。

<table class="table table-striped table-bordered tab-pane dataTable-length" cellspacing="0" width="100%">
    <thead>
        <tr>                              
            <th>Task Name</th>
                <th>Status</th>

                           </tr>

                            </thead>
                            <tbody>
                                <tr ng-repeat="TaskModel in List | filter : paginate | filter:search" ng-class-odd="'odd'">
    <td>{{TaskModel.TaskName}}</td>
                                <td>{{TaskModel.Status}}</td>
    </tr>
    </tbody>
</table>

Im getting Data Not found at bottom of table

0 个答案:

没有答案