Closed dreamid27 closed 6 years ago
deleteRole(objModel: RoleModel)
{
var message = `Apakah abda yakin akan manghapus ${objModel.name} ?`;
var that = this;
this.iziToast.question({
...
buttons: [
['<button><b>YA</b></button>', (instance, toast) => {
instance.hide(toast, { transitionOut: 'fadeOut' }, 'button');
this.roleService.getRoles();
}, true],
['<button>NO</button>', (instance, toast) => {
instance.hide(toast, { transitionOut: 'fadeOut' }, 'button');
}]
],
onClosing: () => {
that.roleService.getRoles();
}
});
@Albejr Ahhhh, Thank bro, it's solved, you really - really help me.
I'm sorry for ask this stupid question, I just started being a programmer.
but, can I ask some question? as far as i know, change the code 'function () ' to ' () =>' it's just change es5 to es6. and actually, it is the same.
what actually makes it different?
In this case, the "this" scope of a "function () {}" is only internal to the function itself.
With "arrow function" it can be either the scope of a function or the global scope.
ahh i see, thank very much for explaining that.
I will close it
Hi plauzul, thank for your awesome plugin, that helps me. but I have some problem. when I try to make this question toast.
I'm trying in OnClosing event and call my service/my function, but it does not work! the error say Cannot read property 'roleService' of undefined. and I think it's happen in any event. cause the TypeScript/Angular have different habits.
This is my code, sorry for my bad English,