jdubois / spring-on-azure

Demo app for https://dev.to/jdubois/creating-a-spring-boot-and-angular-application-for-azure-1-7-2mb8
11 stars 15 forks source link

Type compilation issue on Angular 11+ #7

Open geno-github opened 2 years ago

geno-github commented 2 years ago

Constructor in application-insights.service.ts will not compile in Angular 11 due to type issues. Here is the problematic code:

constructor(private router: Router) { this.appInsights.loadAppInsights(); this.routerSubscription = this.router.events.pipe(filter(event => event instanceof ResolveEnd)).subscribe((event: ResolveEnd) => { const activatedComponent = this.getActivatedComponent(event.state.root); if (activatedComponent) { this.logPageView(${activatedComponent.name} ${this.getRouteTemplate(event.state.root)}, event.urlAfterRedirects); } }); }

Here is working code:

constructor(private router: Router) { this.appInsights.loadAppInsights(); this.routerSubscription = this.router.events.pipe( filter((event): event is ResolveEnd => event instanceof ResolveEnd) ) .subscribe(event => { const activatedComponent = this.getActivatedComponent(event.state.root); if (activatedComponent) { this.logPageView(${activatedComponent.name} ${this.getRouteTemplate(event.state.root)}, event.urlAfterRedirects); } }); }

jdubois commented 2 years ago

Hi @geno-github - this repo is more than 2 years old, and I had forgotten about it!

If you want the latest version of everything that is built with JHipster, have a look at https://www.jhipster.tech

geno-github commented 2 years ago

I found this repo while searching for a way to filter app insights data in an Angular app. Your code is very nice and easy to use. Thanks! Geno

On Fri, Oct 15, 2021 at 10:48 AM Julien Dubois @.***> wrote:

Hi @geno-github https://github.com/geno-github - this repo is more than 2 years old, and I had forgotten about it!

If you want the latest version of everything that is built with JHipster, have a look at https://www.jhipster.tech

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jdubois/spring-on-azure/issues/7#issuecomment-944407600, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADVIRERDFYT4HZ6FZRUTJBTUHBEOPANCNFSM5GCIAJCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Geno Salvati

jdubois commented 2 years ago

Oh thanks a lot @geno-github ! Again, please have a look at https://www.jhipster.tech - this what generated this application, and in 2 years we have made considerable progress. If you liked this, you will love JHipster 100x more. And it's also fully OSS and on GitHub.

geno-github commented 2 years ago

It's a fascinating project. Thanks!

Perhaps you live near Normandie? I have family there named Dorriere. Bon Journee. Geno

On Fri, Oct 15, 2021 at 11:02 AM Julien Dubois @.***> wrote:

Oh thanks a lot @geno-github https://github.com/geno-github ! Again, please have a look at https://www.jhipster.tech - this what generated this application, and in 2 years we have made considerable progress. If you liked this, you will love JHipster 100x more. And it's also fully OSS and on GitHub.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/jdubois/spring-on-azure/issues/7#issuecomment-944417367, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADVIREQZKX2X3GW4LI56THDUHBGCZANCNFSM5GCIAJCQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

-- Geno Salvati