简体   繁体   中英

Getting error while implementing angular-calendar code of stackblitz

I have implemented code of angular calendar in my project mentioned in link - https://mattlewis92.github.io/angular-calendar/#/kitchen-sink .

The code is running fine in Stackblitz but when I copied the same code in my project, I am getting following error at this line:

@ViewChild('modalContent', { static: true }) modalContent: TemplateRef;

Error message is as follow-

Argument of type '{ static: boolean; }' is not assignable to parameter of type '{ read?: any; }'. Object literal may only specify known properties, and 'static' does not exist in type '{ read?: any; }'

Can anyone please suggest how to solve this error.

Remove { static: true } if you are running angular version < 8

It would be just:

  @ViewChild('modalContent') modalContent: TemplateRef;

The static option was only added in Angular 8. The error means that Stackblitz is using the most recent version of Angular while in your project you use Angular <= 7.

Either update your Angular version or remove the static field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM