Closed hoangph91 closed 4 years ago
You can hide action buttons on ng2-smart-table on settings object. Like this
actions: { add: false, edit: false, delete: false, }
Check ng2-smart-table documentation
@lautaro-osacar : Thanks you, but I implement role and permission on ngx-admin , I want to hide action buttons by permission before the user authen .
Can you help me ?
Maybe you can implement it on ngOnInit() of table's component. Something like this:
ngOnInit() {
const newSettings = {...this.settings};
this.userService.getUser().subscribe(user => {
if (!user.permissions.includes(delete_posts)){
newSettings.delete = false;
}
this.settings = Object.assign({}, newSettings);
)}
}
Something like https://github.com/AlexKhymenko/ngx-permissions may help
Thank you @lautaro-osacar ! Closed as answered
Now, I using ngx-admin for my project , I have to ng2-smart-table with security in ngx-admin, But I dont know how to hidden buttons in actions , as button delete, edit ...
Can I help you ?.
thanks you so much!