From 2d4b4f446908bf74b69ac02cff36ce3e70880ca7 Mon Sep 17 00:00:00 2001 From: Ruby Boyarski Date: Wed, 24 Aug 2016 15:26:57 +0300 Subject: [PATCH] feat: Added materializeActions, to allow triggering Materialize actions on a component or globally --- README.md | 19 ++++++++++++++++++ app/components/dialogs.ts | 22 +++++++++++++++++---- app/components/dropdown.ts | 6 +++--- src/materialize-directive.ts | 38 ++++++++++++++++++++++++------------ 4 files changed, 66 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 6258f96..35b36c5 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,25 @@ The [Materialize](https://github.com/InfomediaLtd/angular2-materialize/blob/mast ``` +Another useful option is amitting actions on an element. You may want to do that for calling Materialize functions, like closing a modal dialog or triggering a toast. You can do that by setting the **materializeActions** attribute, which accepts an [EventEmitter](https://angular.io/docs/ts/latest/api/core/index/EventEmitter-class.html) : +```html + +``` +```js + actions = new EventEmitter(); + closeModel() { + this.actions.emit("closeModal"); + } +``` + For dynamic select elements apply the **materializeSelectOptions** directive to trigger element updates when the options list changes: ```html