fulls1z3 / ngx-meta

Dynamic page title & meta tags utility for Angular (w/server-side rendering)
MIT License
333 stars 47 forks source link

tags not updating for lazy modules (AOT) #171

Closed acostajohn closed 4 years ago

acostajohn commented 6 years ago

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

[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Support request => <!-- Please check the repository for a similar issue or PR before submitting -->
[ ] Feature request
[ ] Documentation issue or request

Current behavior

With AOT, for routes lazily loading modules, the meta tags are not being updated, instead, those get cleared out. It works as expected by using JIT, tho.

Example:

app-routing.module.ts

const routes: Routes = [
  {
    path: 'home',
    canActivateChild: [MetaGuard]
    loadChildren: './home/home.module#HomeModule',
    data: { 
      meta: { // this doesn't take effect with AOT. Neither using  canActivate nor canActivateChild
        title: 'my title',
        description: 'my description'
      }
    }
  },
];

home-routing.module.ts

const routes: Routes = [
  {
    path: 'product',
    data: { 
      meta: { // this isn't taking effect either
        title: 'my product title',
        description: 'my product description'
      }
    }
  },
];

Expected/desired behavior

The root route should update their tags properly with the data stated in the data section as well as the child routes that are lazily loaded.

Minimal reproduction of the problem with instructions

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

Environment

leanpilar commented 6 years ago

same issue here... and because only the homepage is not lazy, almost the entire ngx-meta is not working