ng2-tree icon indicating copy to clipboard operation
ng2-tree copied to clipboard

Incompatibility with Angular 6 AOT (Cannot read property 'New' of undefined)

Open reimago opened this issue 6 years ago • 5 comments

Hi. Using Angular 6 and building the application for production (AOT). When creating the tree it gives this error and the tree is not created. :-(

reimago avatar May 10 '18 09:05 reimago

The error seems to occur in: ng2-tree\src\tree.js: 858.

  function () {          return this.node._status === tree_types_1.TreeStatus.New;      };

reimago avatar May 10 '18 09:05 reimago

Yes it has to do with angular 6 and it's in production mode only. Was about to deploy an app and this blew everything off. Now, I'm not sure if it's worth waiting a fix or going straight after the new native angular material tree widget.

kperdomoc avatar May 14 '18 08:05 kperdomoc

I think it's related to the "buildOptimizer". I turned it off in the file "angular.json" (configurations-> production-> buildOptimizer). I have set it to "false" and now it works for me !! I do not know if it is ng2-tree or buildOptimizer problem. While it is fixed I will leave it deactivated.

reimago avatar May 14 '18 12:05 reimago

@reimago thanks I'll give that I try. For now I just downgraded to angular 5 to get things going fast.

kperdomoc avatar May 14 '18 16:05 kperdomoc

The issue is still there. We can't go back to angular 5. Is there any solution for this with Angular 6 AOT @rychkog , @akkumar

Misikir avatar May 15 '18 11:05 Misikir