ngx-countme
Angular 2+ custom directive that counts the number of words, letters, numbers, characters, and spaces in any text-based HTML or FORM element. Dynamically updates when the content inside the element is modified as well.
Installation
To install this library, run:
$ npm install ngx-countme --save
Usage
Add the directive in any element of your Angular application's template:
<!-- You can now use your library component in app.component.html -->{{title}}Words: {{result && result.words}}, Letters: {{result && result.letters}}, Spaces: {{result && result.spaces}}
In your Angular AppModule
, import the library then use the CountmeService
to count any text in your application logic:
;;; // Import the library;
Parameters
Parameter | Type | Default | Description |
---|---|---|---|
countme | json | null |
Results as JSON object |
License
MIT © Kris Nyunt