AngularJS angular-按钮中的数据表自定义属性

AngularJS angular-datatables custom attribute in buttons

我在 npm 中使用以下内容:

"dependencies": {
    "angular": "1.6.4",
    "datatables.net": "1.10.19",
    "datatables.net-buttons": "1.5.3",
    "datatables.net-buttons-dt": "1.5.3",
    "angular-datatables": "0.6.2",
    // and more that is not question related
}

当我现在创建一个类似于 angular 的 DataTable 时-datatables 告诉示例,一切都运行良好。
例如:

vm.dtOptions = DTOptionsBuilder
    .newOptions()
    // data fetch and processing animation and ...
    .withButtons([
        'colvis',
        'copy',
        'print',
        'excel',
        'pdf',
        {
            text: 'Some button',
            key: '1',
            action: function (e, dt, node, config) {
                alert('Button activated');
            },
            className: 'someCustomCssClass',
        },
    ])
    .withBootstrap();
vm.dtColumns = [
    DTColumnBuilder.newColumn('id').withTitle('ID').withClass('text-danger'),
    DTColumnBuilder.newColumn('firstName').withTitle('First name'),
    DTColumnBuilder.newColumn('lastName').withTitle('Last name')
];

现在我要修改自定义按钮"Some button"。
我希望按钮具有自定义 HTML 属性。

当前按钮呈现如下:

<button class="dt-button someCustomCssClass ng-scope" tabindex="0" aria-controls="DataTables_Table_0" type="button">
    <span>Some button</span>
</button>

但该按钮应具有 "access" 属性,以便 hide/show 该按钮取决于用户角色。
所以它应该是例如:

<button access="ROLE_ADMIN" class="dt-button someCustomCssClass ng-scope" tabindex="0" aria-controls="DataTables_Table_0" type="button">
    <span>Some button</span>
</button>

但是如何向按钮添加新属性?
使用 "className" 添加自定义 CSS class 很容易,但是一个全新的属性?

感谢您的帮助,
问候

更新

目前我正在附加一个完全自定义的按钮,如下所示:

var myEl = angular.element( document.querySelector( '.dataTables_wrapper > .dt-buttons' ) );
myEl.append('<button with all my needs></button>');
$compile(myEl.contents())(scope);

这是可行的,但现在我不能使用 DataTable 信息,而且集成本身很差。
这也是一种解决方法,根本没有好的解决方案!
我真的希望@davidkonrad提到的init可以解决这个问题。

对要使用自定义属性丰富的按钮使用 init 回调:

.withButtons([
    'colvis',
    'copy',
    'print',
    'excel',
    'pdf',
    {
        text: 'Some button',
        key: '1',
        action: function (e, dt, node, config) {
            alert('Button activated');
        },
        className: 'someCustomCssClass',
        //-----------------------------------
        init: function(dt, node, config) {
            node.attr('access', "ROLE_ADMIN")
        }
    },
])