I have upgraded my Angular project from Angular version 8 to Angular version 9. it was upgraded successfully but when I am running the project on localhost or when I am trying to build my project it is giving me the following error.
ERROR in @ViewChild options must be an object literal
here is my @ViewChild syntax in some files that I am using.
@ViewChild('subjectbox',null) private elementRefsub: ElementRef;
I don't know what I am doing wrong here.
can anyone please help with this?
Thanks in Advance!
If you do not need a metadata, you can write:
@ViewChild('subjectbox') private elementRefsub: ElementRef;
Metadata Properties: (examples for properties listed for your reference)
selector - The directive type or the name used for querying.
read - Used to read a different token from the queried elements.
@ViewChild('subjectbox', { read: ElementRef }) private elementRefsub: ElementRef;
static - True to resolve query results before change detection runs, false to resolve after change detection. Defaults to false.
@ViewChild('subjectbox', { static: false }) private elementRefsub: ElementRef;