-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetTitle programmatically #7
Comments
Hey @martinop . To set the document title in the component you can just use the Angular Title service: |
@martinop I've just published v2.0.0 on npm. Can you use that version and report back here if you're still running into issues with |
I have the same problem with v2.0.1 (installed from github due to #13). I am using angular2 and ng2-meta with webpack. Using setTitle in AppComponent works but is instantly overriten by either title from route meta or default title from MetaConfig (depending on whether meta title is provided for route).
Using setTitle on other any of route components does nothing. Using setTag is fine.
|
Hey @rybaczewa, I'm aware of this possibility. A component's constructor is called (and I intended for setTimeout(() => {
this.metaService.setTitle('test');
}); Meanwhile, I'll look into making sure that programmatic changes have precedence over route meta and default values. |
Oh, I see. I assumed that setTitle at respects MetaConfig defaults, especially title suffix (so there's no need for suffix to be set every time I use setTitle). Thanks for the info though. |
@vinaygopinath Is it ok to use in setTimeout(). Is it a proper way for SEO ? |
Why this doesnt work? Just the tags works. rc5
The text was updated successfully, but these errors were encountered: