ksachdeva/angular2-swing-example

Undefined Objects!

berryverschueren opened this issue · 5 comments

Hi,

When using this component I get some errors in the app.component.ts.

In line 51 - 59 there are some console.log calls, the first log results in an object. The second and third logs return undefined. This means the viewChild / viewChildren are not correctly returned. I cannot figure out why this is happening..

Can you please assist me with this problem?

Thanks,
Berry

Hello @berryverschueren I will check this out over the weekend and confirm if Im getting the same on my end. Thanks.

Hello @berryverschueren - I tried this locally and am not getting any issues. The objects are logging out as normal. Are you making any changes to the component?

Hi @mashhoodr ,

I did change some things, since I'm trying to integrate it in my project. The thing is that the viewChild or viewChildren are just not getting parsed. That is why the rest of the code is not working, because the objects are null.

When I try to run your project as a stand alone application, I get no issues. Was just wondering if you knew why this viewChild / viewChildren thing was not working? I'm not as experienced as you are in Angular2 I think. (Could it be that some other modules are clashing with this project?)

Thanks,
Berry
stack.zip

@berryverschueren you just need to make sure they are referenced properly in template and you are using them after the ngAfterViewInit life cycle event.

Hi @mashhoodr ,

Just to end this issue on a good note. The problem was not with your code but with mine. I started my project using the NPM Quickstart based on this tutorial: https://angular.io/docs/ts/latest/tutorial/

This in some way seems to collide with your code / dependencies. Now that I have restarted my project using the NG CLI it's working perfectly fine!

Thanks again.
Berry