簡體   English   中英

angular js數據表ng-click不起作用

[英]angular js data table ng-click not working

我正在使用 Angular js 數據表。 目前我需要傳遞行 ID。 因此我試圖調用 ng-click function。 但它不工作。 請檢查以下代碼

$scope.dtOptions = DTOptionsBuilder.newOptions()
        .withOption('ajax', {
            dataType: 'json',
            contentType: "application/json; charset=utf-8",
            url: appConfig.apiUrl + "/approvalList?reqTraceId=" + $scope.requestApprovalId,
            xhrFields: { withCredentials: true },
            type: 'POST',
            data: function (d) {
                return JSON.stringify(d);

            },
            error: function (response) {
                ajaxErrorHandler.handle(response);
            }
        })

        .withDataProp('data')
        .withOption('processing', true)
        .withOption('serverSide', true)
        .withOption('scrollY', '400px')
        .withOption('scrollX', '100%')
        .withOption('scrollCollapse', true)

        .withOption('drawCallback', function (settings) {

        });

    $scope.dtColumns = [
        DTColumnBuilder.newColumn('traceId').withTitle('Trace ID').withClass('cus-id'),
        DTColumnBuilder.newColumn('approval.0.usr').withTitle('Name').withClass('cus-id'),
        DTColumnBuilder.newColumn('approval.0.threshold').withTitle('Match Strength %').withClass('cus-id'),
        DTColumnBuilder.newColumn('traceId').withTitle('Action').renderWith(function (data, type, full) {
            return '<div class="btn-group-xs">' +
                '  <button type="button" class="btn btn-flat btn-xs btn-success" ng-click="passId();">' +
                '    <i class="ion ion-eye"></i>' +
                '  </button>' +
                '</div>';
        }).withClass('text-center').notSortable()
    ];

我在下面使用 function 進行測試。 但是 Function 沒有調用。

 $scope.passId= function () {
        alert("hi")
    };

我如何使用此代碼調用 function。 謝謝

function passId 應該在同一個 controller 內,那么只有它才能工作,請檢查。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM