ng: areq Требуется аргумент 'scope' - ошибка в угловых значениях при рендеринге данных - PullRequest
0 голосов
/ 17 сентября 2018

Я пытаюсь сделать пользовательскую фильтрацию вместе с нумерацией страниц на стороне сервера. При нажатии на кнопку фильтра ($scope.ok) он будет отображать данные. В первый раз все работает нормально. Но во второй раз, когда он достигает $scope.dtInstance.rerender();, он выдает ошибку выше [ng:areq] Argument 'scope' is required. Это я уже пробовал:

var serverData = function (sSource, aoData, fnCallback, oSettings) {
        var draw = aoData[0].value;
        var order = aoData[2].value;
        var start = aoData[3].value;
        var length = aoData[4].value;
        var params = {
            start: start,
            limit: length,
            designation: $scope.data.designation,
            department: $scope.data.department,
            priority: $scope.data.priority,
            Client: $scope.data.Client,
            startDate: $scope.data.startDate,
            endDate: $scope.data.endDate,
            startOnboardDate: $scope.data.startOnboardDate,
            endOnboardDate: $scope.data.endOnboardDate,
            status: $scope.data.status,
            myposting: $scope.data.myposting,
            watchId: $scope.data.watchId
        }
        httpService.get(serviceBase + getReuirementListUrl, params).then(function (response) {
            var records = {
                'draw': 0,
                'recordsTotal': 0,
                'recordsFiltered': 0,
                'data': []
            };
            if (response.data) {
                records = {
                    'draw': draw,
                    'recordsTotal': response.data.total,
                    'recordsFiltered': response.data.total,
                    'data': response.data.items
                };
            }

            fnCallback(records);
        });
    }



    $scope.dtColumnDefs = [
     DTColumnBuilder.newColumn("Requirement_Id", "Req Code").withOption('defaultContent', ""),
     //rendering html content
     DTColumnBuilder.newColumn("Requirement_Name", "Req.Name").withOption('defaultContent', "").renderWith(function (data, type, full, meta) {
         return '<td data-container="head" data-toggle="popover" popover-title="Requirements" popover-template="requirementData.html" ng-mouseenter="getRequirementComments('+ full.Requirement_Id +')" popover-trigger="mouseenter" popover-placement="right" class="block"><a ng-click="getRequirementCommentsView('+full.Requirement_Id+')"> '+full.Requirement_Name+' </a></td>'

     }),
    DTColumnBuilder.newColumn("Required_For", "Required For").withOption('defaultContent', ""),
    DTColumnBuilder.newColumn("Designation", "Designation").withOption('defaultContent', ""),
    DTColumnBuilder.newColumn("TechnicalSkills_Required", "TechSkills").withOption('defaultContent', ""),
    DTColumnBuilder.newColumn("Experience_Required ", "Experience").withOption('defaultContent', ""),
    DTColumnBuilder.newColumn("CreatedOn", "Requested Date").withOption('defaultContent', ""),
    DTColumnBuilder.newColumn("ElapsedDate", "Elapsed Days").withOption('defaultContent', ""),
    DTColumnBuilder.newColumn("OnBoard", "On Board").withOption('defaultContent', ""),
    //rendering html content
    DTColumnBuilder.newColumn("Joiningstatus", "Status").withOption('defaultContent', "").renderWith(function (data, type, full, meta) {

        return ' <td class="block" data-html="true"><a data-toggle="popover" popover-title="comments" popover-template="comments.html" ng-mouseenter="getRequirementComments(' + full.Requirement_Id + ')" popover-trigger="mouseenter" popover-placement="left" ng-click="' + full.statusUpdate + ' && UpdateStatus(' + full.Requirement_Id + ')" tooltip-append-to-body="true">' + data + '</a></td>';
    }),
    DTColumnBuilder.newColumn("Action", "Action").withOption('defaultContent', "").renderWith(function (data, type, full) {

       return '  <td ng-if="editRequirementPermission"><a ui-sref="app.requirements.edit({id:' + full.Requirement_Id + '})"><i class="fa fa-pencil-square"></i></a></td>';
    })
    ];




        $scope.dtOptions = DTOptionsBuilder.newOptions()
       .withDOM(
        "<'row'<'col-sm-12'tr>>" +
             "<SSS<'col-sm-5'l><'col-sm-7'p>>"
              )
       .withFnServerData(serverData)
       .withOption('processing', true) //for show progress bar
       .withOption('serverSide', true) // for server side processing
       .withPaginationType('full_numbers') // for get full pagination options // first / last / prev / next and page numbers
       .withDisplayLength(10) // Page size
       .withOption('rowCallback', rowCallback)
       .withOption('drawCallback', drawcallback)





    $scope.data = {
        designation:  '',
        department: '',
        priority: '' ,
        startDate: null ,
        endDate: null,
        startOnboardDate: null,
        endOnboardDate: null,
        status:  null,
        Client:  '',
        myposting:false,
        watchId:false
    };



    $scope.ok = function (selectedItem) {

        $scope.data = {
            designation: selectedItem.designation == undefined ? '' : selectedItem.designation,
            department: selectedItem.department == undefined ? '' : selectedItem.department,
            priority: selectedItem.priority == undefined ? '' : selectedItem.priority,
            startDate: selectedItem.startDate == undefined ? null : selectedItem.startDate,
            endDate: selectedItem.endDate == undefined ? null : selectedItem.endDate,
            startOnboardDate: selectedItem.startOnboardDate == undefined ? null : selectedItem.startOnboardDate,
            endOnboardDate: selectedItem.endOnboardDate == undefined ? null : selectedItem.endOnboardDate,
            status: selectedItem.status == undefined ? null : selectedItem.status,
            Client: selectedItem.Client == undefined ? '' : selectedItem.Client,
            myposting: selectedItem.myposting == undefined || false ? false : true,
            watchId: selectedItem.watchId == undefined || selectedItem.watchId == false ? false : true
        };

        $scope.dtInstance.rerender(); // ERROR THROWN HERE SECOND TIME
    }
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...