2017-05-17 19:23:47 +00:00
|
|
|
import {module} from '../module';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A simple component to show non-obstructive notifications to the user.
|
|
|
|
*/
|
|
|
|
export default class Controller {
|
|
|
|
constructor($element) {
|
|
|
|
this.snackbar = $element[0].firstChild;
|
|
|
|
componentHandler.upgradeElement(this.snackbar);
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
* Shows a notification.
|
|
|
|
*
|
|
|
|
* @param {Object} data The message data
|
|
|
|
*/
|
|
|
|
show(data) {
|
|
|
|
this.snackbar.MaterialSnackbar.showSnackbar(data);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
Controller.$inject = ['$element'];
|
|
|
|
|
|
|
|
module.component('vnSnackbar', {
|
2017-05-31 08:28:39 +00:00
|
|
|
template: require('./snackbar.html'),
|
2017-05-17 19:23:47 +00:00
|
|
|
controller: Controller
|
|
|
|
});
|