Add placeholder to select tag in angular2

后端 未结 15 1709
眼角桃花
眼角桃花 2021-01-03 19:54

I have simple component that contains only form:

import {Component, FORM_DIRECTIVES, NgFor} from \'angular2/angular2\';


@Component({
  selector: \'test-com         


        
15条回答
  •  孤独总比滥情好
    2021-01-03 20:48

    I know i'm late , this is how i'm doing ,

    initializeSelectOptions(){
     this.optionList = ['..' , '..' , '..'
      ];
     this.optionList.unshift('Select Options')
    }
    
    ngOnInit(){
     this.initializeSelectOptions();
    }
    

    In my template ,

    
    

提交回复
热议问题