Socket
Socket
Sign inDemoInstall

angular2-elastic

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    angular2-elastic

Angular 2 directive to auto expand textareas according to their contents.


Version published
Weekly downloads
15
increased by36.36%
Maintainers
1
Install size
17.1 kB
Created
Weekly downloads
 

Changelog

Source

[0.13.0] - 2017-01-11

Breaking Change

  • Exports ElasticModule instead of Elastic. If upgrading, please update your imports, change Elastic to ElasticModule:
import { ElasticModule, ElasticDirective } from 'angular2-elastic';

Readme

Source

Angular2-Elastic

Automatically grows and shrinks textareas based on their content. Supports both regular Angular 2 <textarea> and Ionic 2 <ion-textarea> controls.

See the demo here.

Installation

npm install angular2-elastic

Quick Start

  1. Import the ElasticModule.
  2. Add the directive fz-elastic to your textarea or ion-textarea.
  3. Watch as your textareas automatically grow and shrink depending on their content.

Usage

Angular 2

1. Import the ElasticModule:

import { NgModule }      from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule }   from '@angular/forms';
import { ElasticModule } from 'angular2-elastic';

import { AppComponent }  from './app.component';

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

2. Use the directive in your component HTML:

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

@Component({
  selector: 'my-app',
  template: `<textarea fz-elastic></textarea>`
})
export class AppComponent {};

That's it! Your textarea will now grow and shrink as you type.

The textarea will also respond to changes from any one or two way bindings that are setup, e.g. with [(ngModel)].

Ionic 2

  1. Import the module as above.
  2. Use the directive on an ion-textarea instead:
<ion-textarea fz-elastic></ion-textarea>

License

MIT

Credits

Heavily inspired by the following:

Keywords

FAQs

Last updated on 11 Jan 2017

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc