Javascript 如何使用angularjs和asp.net重新加载ng重复数据

Javascript 如何使用angularjs和asp.net重新加载ng重复数据,javascript,asp.net,angularjs,Javascript,Asp.net,Angularjs,如何将数据代码传递给angularjs变量。页面加载时工作正常。但当我点击按钮,过滤数据。服务器端不加载数据 $scope.studentinformation= //Angularjs变量 <script type="text/javascript"> var app = angular.module('myApp', []); app.controller('myCtrl', ['$scope', '$filter', functi

如何将数据代码传递给angularjs变量。页面加载时工作正常。但当我点击按钮,过滤数据。服务器端不加载数据

$scope.studentinformation=

//Angularjs变量

<script type="text/javascript">
            var app = angular.module('myApp', []);
            app.controller('myCtrl', ['$scope', '$filter', function ($scope, $filter) {
                $scope.currentPage = 0;
                $scope.pageSize = 100;
                $scope.data = [];
                $scope.q = '';

                $scope.studentinformation = <%= studentattendancejson %>
                $scope.getData = function () {


                    return $filter('filter')($scope.studentinformation, $scope.q)

                }
                $scope.numberOfPages = function () {
                    return Math.ceil($scope.getData().length / $scope.pageSize);
                }


            }]);

            app.filter('startFrom', function () {
                return function (input, start) {
                    start = +start; //parse to int
                    return input.slice(start);
                }
            });

        </script>

 <tr ng-repeat="info in studentinformation| filter:q | startFrom:currentPage*pageSize | limitTo:pageSize">
                                                    <td>{{info.student_name}}</td>
                                                    <td>{{info.father_name}}</td>
                                                    <td>{{info.class_name}}</td>
                                                    <td>{{info.attendancedate | date:'dd-MM-yyyy'}}</td>
                                                    <td ng-if="info.attendanceType == 'Present'"> <button type="button" class="btn btn-success btn-circle"><i class="fa fa-check"></i></td>
                                                     <td ng-if="info.attendanceType == 'Absent'"> <button type="button" class="btn btn-danger btn-circle"><i class="fa fa-times"></i></td>
                                                     <td ng-if="info.attendanceType == 'Leave'"> <button type="button" class="btn btn-warning btn-circle"><i class="fa fa-list"></i></td>


                                                </tr>

var-app=angular.module('myApp',[]);
app.controller('myCtrl',['$scope','$filter',函数($scope,$filter){
$scope.currentPage=0;
$scope.pageSize=100;
$scope.data=[];
$scope.q='';
$scope.studentinformation=
$scope.getData=函数(){
返回$filter('filter')($scope.studentinformation,$scope.q)
}
$scope.numberOfPages=函数(){
返回Math.ceil($scope.getData().length/$scope.pageSize);
}
}]);
app.filter('startFrom',函数(){
返回功能(输入、启动){
start=+start;//解析为int
返回input.slice(开始);
}
});
{{info.student_name}
{{info.father_name}
{{info.class_name}
{{info.attendancedate}日期:'dd-MM-yyyy'}
页面加载工作正常

按钮点击按钮事件不显示数据,下面是结果

Razor c#仅在发出请求时运行,因此不会更改studentattendancejson。我认为您需要研究如何使用ajax从服务器获取信息
<script type="text/javascript">
            var app = angular.module('myApp', []);
            app.controller('myCtrl', ['$scope', '$filter', function ($scope, $filter) {
                $scope.currentPage = 0;
                $scope.pageSize = 100;
                $scope.data = [];
                $scope.q = '';

                $scope.studentinformation = <%= studentattendancejson %>
                $scope.getData = function () {


                    return $filter('filter')($scope.studentinformation, $scope.q)

                }
                $scope.numberOfPages = function () {
                    return Math.ceil($scope.getData().length / $scope.pageSize);
                }


            }]);

            app.filter('startFrom', function () {
                return function (input, start) {
                    start = +start; //parse to int
                    return input.slice(start);
                }
            });

        </script>

 <tr ng-repeat="info in studentinformation| filter:q | startFrom:currentPage*pageSize | limitTo:pageSize">
                                                    <td>{{info.student_name}}</td>
                                                    <td>{{info.father_name}}</td>
                                                    <td>{{info.class_name}}</td>
                                                    <td>{{info.attendancedate | date:'dd-MM-yyyy'}}</td>
                                                    <td ng-if="info.attendanceType == 'Present'"> <button type="button" class="btn btn-success btn-circle"><i class="fa fa-check"></i></td>
                                                     <td ng-if="info.attendanceType == 'Absent'"> <button type="button" class="btn btn-danger btn-circle"><i class="fa fa-times"></i></td>
                                                     <td ng-if="info.attendanceType == 'Leave'"> <button type="button" class="btn btn-warning btn-circle"><i class="fa fa-list"></i></td>


                                                </tr>