@kovalenko/max-length-reached
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

MaxLengthReached

Emits an event if input's max length reached

Usage

First, import the MaxLengthReachedModule to your module:

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { ScrollHereModule } from '@kovalenko/max-length-reached';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { AppComponent } from './app';

@NgModule({
  imports: [BrowserModule, MaxLengthReachedModule],
  declarations: [AppComponent],
  bootstrap: [AppComponent],
})
export class AppModule {}

platformBrowserDynamic().bootstrapModule(AppModule);

In this example, the second input will be focused when the first input will reach max length

import { Component } from '@angular/core';

@Component({
  selector: 'app',
  template: `
    <input type="text" maxlangth="5" (ngcMaxLengthReached)="second.nativeElement.focus()">
    <input type="text" #second>
  `,
})
export class AppComponent {
}

License

MIT

Package Sidebar

Install

npm i @kovalenko/max-length-reached

Weekly Downloads

2

Version

1.0.0

License

MIT

Unpacked Size

22 kB

Total Files

14

Last publish

Collaborators

  • kovalenko