fulls1z3/ngx-meta

change title after API call not reflecting on

shabbir-dhangot opened this issue · 3 comments

I'm submitting a ...

[ x ] bug report => check the README and search github for a similar issue or PR before submitting
[ x ] support request => check the README and search github for a similar issue or PR before submitting
[   ] feature request

Current behavior
Changing title and meta on constructor working and showing on google as well. Changing Title and meta tag after API call. may be difference of 1 sec is not reflecting on the Google.

Expected/desired behavior
I think google bot not waiting for change in title after API call.

Current environment:
Operating System : ubuntu 16.04
IDE : visual studio code
Server : Apache secure server ( https )

  • Angular version: 4.3.3
  • Language: TypeScript

  • Node (for AoT issues): node --version = v8.0.0

@shabbir-dhangot thanks for pointing out this issue, actually in such cases it's better to resolve the result of this observable at the router level.

Anyway, I'll try to figure analyzing the router behavior - but can't promise anything about it.

@shabbir-dhangot Same issue here. Everything works well on locale machine but does not work online. Have you found any solution ?
@fulls1z3 Please can you explain how to resolve the result at router level. For example I'm calling an API to get some pages after the route ends like this:

this.router.events.subscribe((e: any) => {
      if (e instanceof NavigationEnd) {
        this.getPage();
      }
    });

And after I get a response I set meta tags like your example in the docs.
Any help will be appreciated.

I am using Title and Meta service of Angular. Find detail in below article.
Title Service : https://angular.io/guide/set-document-title
Meta Service : https://angular.io/api/platform-browser/Meta