You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
447 B
22 lines
447 B
import { Directive, ElementRef, Input } from '@angular/core';
|
|
import Cleave from 'cleave.js';
|
|
|
|
@Directive({
|
|
selector: '[cleave]'
|
|
})
|
|
export class CleaveDirective {
|
|
|
|
constructor(
|
|
private _elementRef: ElementRef
|
|
) { }
|
|
|
|
@Input()
|
|
public set cleave(options: any) {
|
|
if (this._instance) {
|
|
this._instance.destroy();
|
|
}
|
|
this._instance = new Cleave(this._elementRef.nativeElement, options);
|
|
}
|
|
|
|
private _instance: Cleave;
|
|
}
|