I have created a custom function to display multiple toasts at the same time, but only the last action has the passed values while other values remain as the first toast.
Check out the screenshothttps://i.sstatic.net/IuQYw.png
Here is my code snippet
var setToaster = function(text,action,url,position) {
var toast = $mdToast.simple()
.textContent(text)
.action(action)
.position(position)
.hideDelay(false)
.highlightAction(true)
.highlightClass('md-accent')// Accent is used by default, this just demonstrates the usage.
// .position(pinTo);
return $mdToast.show(toast).then(function (response) {
if (response == 'ok') {
$location.url(url);
}
});
};
var setToaster2 = function(text,action,url,position) {
if (vm.viewForm == false) {
setToaster('Your Client History Form still not completed,Please Complete it', 'Complete', '/client-history', 'top right')
}
if (vm.myVar.complete_profile == true) {
setToaster('Your profile is incomplete, Please Complete your profile', 'Go To Profile', '/user/profile', 'bottom right')
}
Is there an issue with this function? Can the toast feature handle multiple instances like this?