Toasts

Toasts are a component available in Angular Material.
Since most implementations require a success and an error toast, this repository provides you with pre-configured ToastService
that you can easily adjust to fit your needs.
This service allows you to open a success toast and an error toast.
The error toast is also automatically displayed when the API encounters a validation error (using restangular's error interceptor).
While this service has a default delay, position and action text, you can easily change them in angular/services/toast.service.js
. You can also add custom methods.
(function(){
"use strict";
angular.module('app.controllers').controller('PostsController', PostsController);
function PostsController(ToastService){
var vm = this;
vm.success = success;
vm.error = error;
var success = function(){
ToastService.show('Post added successfully!');
};
var error = function(){
ToastService.error('Connection interrupted!');
};
}
})();
Updated less than a minute ago