Angular 6 Material multiple set default value using form control

后端 未结 3 1775
感动是毒
感动是毒 2020-12-19 06:56

I am using form control here is code for my html component

<
3条回答
  •  独厮守ぢ
    2020-12-19 07:33

     
     Select Global Markets
     
     {{list.value}}
     
    

    export class SelectMultipleExample {
        globalmarketCategory= new FormControl();
        toppingList: any[] = [
                            { id:1,value:"test 1"},
                            { id:2,value:"test 2"},
                            { id:3,value:"test 4"},
                            { id:4,value:"test 5"},
                            { id:5,value:"test 6"},
                            { id:6,value:"test 7"}
                            ];
    
    
        list = []
        constructor(){
            const anotherList:any[]=[  
                                    { id:1,value:"test 1"},
                                    { id:2,value:"test 2"}
                                    ]
            this.globalmarketCategory.setValue(anotherList);
        }
    }
    

提交回复
热议问题