tries to convert the function of the first promise swal to observable and try to use the cancel action. Can someone help me with the pls syntax.
swal({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!',
cancelButtonText: 'No, cancel!',
confirmButtonClass: 'btn btn-success',
cancelButtonClass: 'btn btn-danger',
buttonsStyling: false
}).then(function () {
swal(
'Deleted!',
'Your file has been deleted.',
'success'
)
}, function (dismiss) {
if (dismiss === 'cancel') {
swal(
'Cancelled',
'Your imaginary file is safe :)',
'error'
)
}
})
So far I have the following:
export class DialogService {
confirm(title: string, message: string):Observable<any> {
return Observable.fromPromise(swal({
title: title,
text: message,
type: 'warning',
showCancelButton: true
}));
}; }
How to add a function function (dismiss)to the above?
source
share