We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cannot read property 'element' of undefined

Hi,

I tried to update your appointment planner example 


to Angular 8 (in my way to Angular 9).

These are my observations:

1. Cannot read property 'element' of undefined at DoctorAvailabilityComponent.ngOnInit
It appears  / Tooltip / TooltipEventArgs has no "element" argument anymore.

2. Cannot read property 'hide' of undefined at CalendarComponent.ngOnInit
It appears  the Angular Dialog Component has no more Hide properties.

3. Cannot read property 'nativeElement' of undefined  at DoctorsComponent.ngOnInit
It appears another ToolTip issue related to   " this.tooltipObj.appendTo(this.specialistItemObj.nativeElement);"

Thank you very much for your help.

Regards,

Mircea


8 Replies

RV Ravikumar Venkatesan Syncfusion Team February 20, 2020 09:18 AM UTC

Hi Mircea, 

Greetings from Syncfusion Support. 

Currently, we are working on the Angular 9 support and it will be available in any of our upcoming release. Once it is completed, we will check the reported problem and update further details. We would appreciate your patience until then.   
  
Please let us know if you have any concerns. 

Regards, 
Ravikumar Venkatesan 



MI Mircea February 20, 2020 10:53 AM UTC

Hi Ravikumar,

Those errors are for Angular 8, not Angular 9, so the demo should work.

Thank you for your help. 

Regards,

Mircea


GE George February 24, 2020 08:52 PM UTC

Hi Mircea,

In Angular 8+ for @ViewChild decorator (and also for @ContentChild) you have to provide two metadata properties 'selector'  and 'static' (the third metadata property 'read' is optional).
If you access the selected element inside of ngOnInit() you have to set {static: true} and if you don't access selected element in ngOnInit() set {static: false}.  

So, for solving errors:
1. in  DoctorAvailabilityComponent change your code to @ViewChild('availabilityObj'{static: true}) public availabilityObjListView;
2. in CalendarComponent change your code to @ViewChild('specialistObj'{static: true}specialistObjDialogComponent;
3. in DoctorsComponent change your code to @ViewChild('specialistItemObj'{static: true}) public specialistItemObjany;

Regards/Toate cele bune,
George Constantinescu



MI Mircea February 25, 2020 07:44 AM UTC

Hi George,

Thank you for your detailed answer. 

I was using { static: false } for all @ViewChild decorator and the errors were misleading me.

Now it is working....waiting for Angular 9 compatibility.

Regards/ Numai bine,

Mircea


VM Vengatesh Maniraj Syncfusion Team replied to George Constantinescu February 26, 2020 02:17 PM UTC

Hi Mircea,

In Angular 8+ for @ViewChild decorator (and also for @ContentChild) you have to provide two metadata properties 'selector'  and 'static' (the third metadata property 'read' is optional).
If you access the selected element inside of ngOnInit() you have to set {static: true} and if you don't access selected element in ngOnInit() set {static: false}.  

So, for solving errors:
1. in  DoctorAvailabilityComponent change your code to @ViewChild('availabilityObj'{static: true}) public availabilityObjListView;
2. in CalendarComponent change your code to @ViewChild('specialistObj'{static: true}specialistObjDialogComponent;
3. in DoctorsComponent change your code to @ViewChild('specialistItemObj'{static: true}) public specialistItemObjany;

Regards/Toate cele bune,
George Constantinescu


Hi George,

Greetings from Syncfusion Support.

 

Thanks for providing a detailed answer.

 

Regards,

Vengatesh.




VM Vengatesh Maniraj Syncfusion Team replied to Mircea February 26, 2020 02:24 PM UTC

Hi George,

Thank you for your detailed answer. 

I was using { static: false } for all @ViewChild decorator and the errors were misleading me.

Now it is working....waiting for Angular 9 compatibility.

Regards/ Numai bine,

Mircea

Hi Mircea,

 

Thanks for the update.

 

We are happy that the Angular 8 related issues were resolved.

 

And, we are glad that we have provided the Angular 9 support for our controls and it can be available in the version of v17.4.51. Kindly upgrade your package to v17.4.51 to get the support.

 

Regards,

Vengatesh



MI Mircea February 28, 2020 09:13 AM UTC

Hi Vengatesh,

I upgraded the packages to version 17.4.51 and I could compile the application with Angular 9.0.3 without errors.

Thank you very much for your help. 

Regards, 

Mircea




VM Vengatesh Maniraj Syncfusion Team March 2, 2020 06:13 AM UTC

Hi Mircea, 

You are most welcome. 

Please get in touch with us if you require any further assistance. 

Regards, 
Vengatesh. 


Loader.
Up arrow icon