primefaces / primeng

The Most Complete Angular UI Component Library
https://primeng.org
Other
10.48k stars 4.6k forks source link

[Bug] Error trying to use angular 8, bad path import in table.ts #7355

Closed jmesa-sistel closed 5 years ago

jmesa-sistel commented 5 years ago

I'm submitting a ... (check one with "x")

[x] bug report => Search github for a similar issue or PR before submitting
[ ] feature request => Please check if request is not on the roadmap already https://github.com/primefaces/primeng/wiki/Roadmap
[ ] support request => Please do not submit support request here, instead see http://forum.primefaces.org/viewforum.php?f=35

Current behavior

If you try to compile an app using last angular 8 (beta7 in this case) you will get an error

Expected behavior

Minimal reproduction of the problem with instructions

Compile an app which use a p-table using angular 8 beta 7 you will get the next error: ERROR in node_modules/primeng/components/table/table.d.ts(5,27): error TS2307: Cannot find module '@angular/core/src/metadata/lifecycle_hooks'.

What is the motivation / use case for changing the behavior?

Fix a future bug in angular 8

The bug is in table.ts:

import { NgModule, Component, HostListener, OnInit, AfterViewInit, AfterViewChecked, Directive, Optional, AfterContentInit, Input, Output, EventEmitter, ElementRef, ContentChildren, TemplateRef, QueryList, ViewChild, NgZone, EmbeddedViewRef, ViewContainerRef} from '@angular/core';
.....
import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks';
.....

The OnDestroy import has to be in '@angular/core'

JacobSiegle commented 5 years ago

PrimeNG hasn't had a compatible release for Angular 8 yet.

jmesa-sistel commented 5 years ago

@JacobSiegle Primeng is working perfectly in Angular 8 beta 7 after that change. Ivy not enabled.

Mysame commented 5 years ago

It's a bad import that should be fixed regardless.

jbedard commented 5 years ago

Also running into this issue. There would be no harm fixing this, even before any angular 8 support...

coreboarder commented 5 years ago

This strikes me as an easy fix no?

Line 5 in primeng/components/table/table.d.ts change

JacobSiegle commented 5 years ago

It probably is. I don't use angular 8 yet but if you do you can test/PR it and i'm sure they will accept. Otherwise I assume it will be fixed when the official 8 release is out.

cagataycivici commented 5 years ago

Angular 8 is not out yet so closing.

jmesa-sistel commented 5 years ago

@cagataycivici Not yet, but the import is wrong anyway. import { OnDestroy } from '@angular/core/src/metadata/lifecycle_hooks'; is wrong, It's a bad import that should be fixed

kartik468 commented 5 years ago

@cagataycivici Angular 8 is now live. Issue still exists. I can see the commit 97ffa3fb902598044442e8dcb377e65b0e6729b0 (fixed #7627 Support Angular 8) Its not part of latest release i.e. 7.1.3

JanST123 commented 5 years ago

+1

Please update npm package

satheeshhb commented 5 years ago

Just upgraded my application to Angular 8 from 7. I upgraded primeng version to latest version 7.1.3, but still issue persist.

Alternatively as a workaround i have used "import { OnDestroy } from '@angular/core';" and seems like things are working.

But is there any plan to fix this issue in upcoming primeng build?.

dima716 commented 5 years ago

Also facing the issue

jasperbosch commented 5 years ago

+1

armved commented 5 years ago

+1

dmytro-gokun commented 5 years ago

Please make a minor release with the fix, so everybody can start using Angular 8. It looks like primeng is a showstopper for many people.

thackerc commented 5 years ago

@cagataycivici Can you reopen this issue not that Angular 8 is out and this is still a problem?

jmesa-sistel commented 5 years ago

@thackerc Primeng 8.0.0-rc.1 is out with this bug fixed but you will find other bugs. See #7769

pppdns commented 5 years ago

it's still not fixed in 7.1.3, which is the latest minor version in version 7. Is there a time estimate for it? Or did PrimeNG already cut support for any version below 8.0.0 (which is only one week old)?

The change should be as simple as changing 2 lines. Just import OnDestroy from @angular/core, not @angular/core/src/metadata/lifecycle_hooks (see 97ffa3f)

Maybe simply git cherry-pick 97ffa3f after 7.1.3 and release it as 7.1.4?

Thanks a lot in advance @cagataycivici and let me know how I can help

danielsmeyer commented 5 years ago

Fixed in the 8.0.0 release.

pppdns commented 5 years ago

Thanks. And what about 7.x versions? Did PrimeNG already end official support for 7.x?

Angular 8 doesn't work with PrimeNG 7 because of this one small import issue which should only require 2 lines of change. It's not an immediate option for many apps to just upgrade to PrimeNG 8.0.0 as it has a lot of breaking changes (despite the official docs).

This is a show stopper for many apps, PrimeNG 7.1.3, which is the latest of version 7 and which is only one month old, doesn't work with Angular 8. A minor bugfix version could be released at least for PrimeNG v7, this bug really isn't related to Angular 8 at all, it's simply a bad import path.

The change should be as simple as changing 2 lines. Just import OnDestroy from @angular/core, not @angular/core/src/metadata/lifecycle_hooks (see 97ffa3f), and then release the bugfix as 7.1.4.

It's sad to see that only the lastest PrimeNG version is supported, which is 2 weeks old, many other tools support older versions for 1-2 years at least, but really not for just a few weeks.

jmesa-sistel commented 5 years ago

@pppdns breaking changes? There is only a very few little changes. Have you read the changes? https://github.com/primefaces/primeng/blob/master/CHANGELOG.md

pppdns commented 5 years ago

yes, for example Remove DataTable #7759 is not listed as a breaking change, even though it breaks a lot of codebases that use this (previously deprecated) component. Deprecating a feature is no breaking change, but removing the feature is. Having a reliable changelog which lists the breaking changes helps a lot during migration to the new version

orhemi commented 5 years ago

@jmesa-sistel There is any intention to add that fix to 7 version too? For those who are not interested in upgrading to v8

sgentile commented 5 years ago

please fix angular 8 is out

shorstki commented 4 years ago

Why this is closed? Same issue here

shubhamtakode commented 4 years ago

Please fix this issue.

blackstrings commented 4 years ago

as stated in https://github.com/primefaces/primeng/issues/7769, anyone on or upgrading to Angular 8, should use primeng version 8 and install the following dependency chart.js and quill and don't forget to add the two scripts into the angular.json