Created
May 15, 2017 15:35
-
-
Save falendary/d6202d14edd0ad925ac9e064f7bab07f to your computer and use it in GitHub Desktop.
Transform `<option value="1: '2'"></option>` to <option value="2"></option> in Angular2 <select multiple>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Directive, ElementRef} from '@angular/core'; | |
import {Input} from '@angular/core'; | |
@Directive({ | |
selector: '[multipleNormalize]', | |
}) | |
export class MultipleNormalizeDirective { | |
@Input('multipleNormalize') model:any; | |
constructor(private elementRef:ElementRef) { | |
} | |
ngOnInit(): void { | |
this.elementRef.nativeElement.value = this.model; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment