I have implemented the directive to restrict the input field using angular2. It is working fine in desktop browser, but not working in android mobile.
you should use max-length html5 attribute and then use form validation for Angular2, no custom directive needed.