Angular @ViewChild() error: Expected 2 arguments, but got 1

后端 未结 11 2645
时光取名叫无心
时光取名叫无心 2020-11-29 18:10

When trying ViewChild I am getting the error. Error is \"An argument for \'opts\' was not provided.\"

Both @ViewChild is giving the error.



        
11条回答
  •  死守一世寂寞
    2020-11-29 18:24

    it is because view child require two argument try like this

    @ViewChild('nameInput', { static: false, }) nameInputRef: ElementRef;

    @ViewChild('amountInput', { static: false, }) amountInputRef: ElementRef;

提交回复
热议问题