angular2-dimensions-directive

1.1.0 • Public • Published

angular2-dimensions-directive

Fires an Event with the (initial) dimensions of a DOM element and also whenever the dimensions change

npm version

forthebadge

Install

npm i angular2-dimensions-directive --save

Import the directive to your project and use it in your Component defining an event handler that is called whenever the dimensions of the element change

import { DimensionsDirective } from 'angular2-clickoutside-directive';
 
@Component({
  selector: 'my-app',
  template : `
  <div clickOutside (onDimensionsChange)="onDimensionsChangeHandler($event)"">
    A button
  </button>`,
  directives : [  ClickOutsideDirective ]
} )
class MyFirstComponent implements OnInit {
  constructor(){}
 
  onDimensionsChange($event)
  {
    console.log( $event.dimensions )
  }
 
  ngOnInit(){}
}

Contribute

Any pull-request is more than welcome 💥 😄

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code.

License

MIT

Package Sidebar

Install

npm i angular2-dimensions-directive

Weekly Downloads

3

Version

1.1.0

License

MIT

Last publish

Collaborators

  • avrmav