The idea is to use directives to implement it, but I am stuck and don’t know how to expose the API to the controller
I want to call the APIxxx.showToast
in the controller when popping up the toast, but I don’t know how to get this interface, and the directive cannot be used as a dependency injection. I am stuck here. I hope you can give me some advice.
You can just take the directive and write it and use it directly
css code
.toast-box{
}
.toast-top{
}
.toast-bottom{
}
.toast-box .toast-item{
}
.toast-box .toast-item.toast-success{
}
.toast-box .toast-item.toast-error{
}
.toast-box .toast-item.toast-warn{
}
.toast-box .toast-item.toast-info{
}
directive code
angular.module('app').directive('toast', function() {
});
function getToastClass(type) {
}
html usage
Controller usage
$scope.toast = { text: "Hellow", type: 1, timeout: 1000, max: 2 };
You can use AngularJS-Toaster
https://github.com/jirikavi/A...
The angularjs-toaster mentioned above is very easy to use and can be used. Or write a service and use it through di.
I have used sweet alert before and it seems to be ok.
http://t4t5.github.io/sweetal...