How to use onBlur event on Angular2?

Use (eventName) for while binding event to DOM, basically () is used for event binding. Also use ngModel to get two way binding for myModel variable. Markup Code Demo Alternative(not preferable) Demo For model driven form to fire validation on blur, you could pass updateOn parameter. Design Docs

Angular 2 Sort table columns

I assume you are loading the data (selectedData) for this template asynchronously in the component’s class, so at the start it’s not yet returned form the service, hence selectedData = undefined. There are several things you can do to mitigate that: 1. Initialize the data in the component Set the selectedData class property to an empty array so … Read more

Mask for an Input to allow phone numbers?

Angular5 and 6: angular 5 and 6 recommended way is to use @HostBindings and @HostListeners instead of the host property remove host and add @HostListener Working Online stackblitz Link: https://angular6-phone-mask.stackblitz.io Stackblitz Code example: https://stackblitz.com/edit/angular6-phone-mask Official documentation link https://angular.io/guide/attribute-directives#respond-to-user-initiated-events Angular2 and 4: Plunker >= RC.5 original One way you could do it is using a directive that injects NgControl and manipulates the … Read more