diff --git a/src/core/components/send-message-form/core-send-message-form.html b/src/core/components/send-message-form/core-send-message-form.html index 292f9c2f2..74fadaad4 100644 --- a/src/core/components/send-message-form/core-send-message-form.html +++ b/src/core/components/send-message-form/core-send-message-form.html @@ -17,7 +17,7 @@ > + [attr.aria-label]="'core.send' | translate" [core-suppress-events] (onClick)="submitForm($event)"> diff --git a/src/core/directives/supress-events.ts b/src/core/directives/supress-events.ts index e651b1eca..0ec7aab2e 100644 --- a/src/core/directives/supress-events.ts +++ b/src/core/directives/supress-events.ts @@ -15,6 +15,7 @@ // Based on http://roblouie.com/article/198/using-gestures-in-the-ionic-2-beta/ import { Directive, ElementRef, OnInit, Input, Output, EventEmitter } from '@angular/core'; +import { CoreLogger } from '@singletons/logger'; /** * Directive to suppress all events on an element. This is useful to prevent keyboard closing when clicking this element. @@ -29,6 +30,8 @@ import { Directive, ElementRef, OnInit, Input, Output, EventEmitter } from '@ang * If you only want to suppress a single event just pass the name of the event. If you want to suppress a set of events, * pass an array with the names of the events to suppress. * + * Usage of onClick instead of click is mandatory to make this directive work. + * * Example usage: * * @@ -51,6 +54,13 @@ export class CoreSupressEventsDirective implements OnInit { * Initialize event listeners. */ ngOnInit(): void { + if (this.onClick.observers.length == 0) { + CoreLogger.getInstance('CoreSupressEventsDirective') + .error('No onClick output was defined causing this directive to fail', this.element); + + return; + } + let events: string[]; if (this.suppressEvents == 'all' || typeof this.suppressEvents == 'undefined' || this.suppressEvents === null) {