Comments (6)
You can solve it for now to use the function like this:
this.metadata.setTitle('Blog - ' + hello, false, false);
This disables the deferred part of the function
from ngx-meta.
Hi guys, I've been working on universal (aka platform-server) integration, and seems like it will be resulted soon. Then, I'll be able to release fixes for the listed bugs together with server-side rendering support.
from ngx-meta.
Hi @chrillewoodz, @cybey, @bjornharvold, I've tested the issue documented above, using the latest version (@nglibs/meta
** v0.2.0-beta.4) on the @nglibs/example-app.
Without touching the default configuration (and also the meta
properties at the routes), I've modified the src/app/+home/home.component.ts
as follows:
// angular
import { Component, OnInit } from '@angular/core';
// libs
import { MetaService } from '@nglibs/meta';
@Component({
template: `@nglibs home page<br/>
Enjoy it!<br/>`
})
export class HomeComponent implements OnInit {
constructor(private meta: MetaService) {
}
ngOnInit(): void {
const luckyPerson = 'chrillewoodz';
this.meta.setTitle('Today, the lucky person is: ' + );
}
}
The output (page title) was exactly:
Today the lucky person is: chrillewoodz | @nglibs example app
It worked when the title
argument was a string concatenation.
Then I modified src/app/+home/home.component.ts
further, using an observable:
// angular
import { Component, OnInit } from '@angular/core';
// libs
import { Observable } from 'rxjs/Observable';
import { MetaService } from '@nglibs/meta';
@Component({
template: `@nglibs home page<br/>
Enjoy it!<br/>`
})
export class HomeComponent implements OnInit {
constructor(private meta: MetaService) {
}
private getTitle(): Observable<string> {
return Observable.of('cybey');
}
ngOnInit(): void {
this.getTitle().subscribe((res: string) => {
this.meta.setTitle('Today the lucky person is: ' + res);
});
}
}
The output (page title) was exactly:
Today the lucky person is: cybey | @nglibs example app
It worked also when part of the title
argument was supplied from an Observable.
So, I could not reproduce the issue based the information you provided - using the official showcase app @nglibs/example-app with the development environment mentioned below:
-
Angular version: 4.0.1
-
Browser: Chrome 56.0.2924.87 (64-bit)
-
Language: TypeScript 2.2.2
-
Node (for AoT issues):
node --version
= 6.10.10
Please make sure you're using the latest version of @nglibs/meta
** (v0.2.0-beta.4 at the moment). If there're any points you forgot to mention, or need more details feel free to ask again.
For now, I'm closing this issue.
Note: @bjornharvold, I didn't forgot you. You'll be featuring as the lucky person shown on the page title, just at the further issue 😄
from ngx-meta.
I'm not sure if it's worth noting but it's inside a subscription call and it can run several times. When I do a test like this outside the subscription call it works as expected:
const hello: string = 'Hello world';
this.metadata.setTitle('Blog - ' + hello);
from ngx-meta.
Hi @chrillewoodz, thanks for your inspections.
I’ll look into this as soon as possible and then pingback on this issue my findings.
from ngx-meta.
+1
from ngx-meta.
Related Issues (20)
- remove lodash peerDependency as it's not needed
- meta tags API call fails HOT 2
- meta doesn't get updated.
- upgrade to Angular 7 HOT 1
- Not fetching meta tags in web master HOT 1
- Make configurable callback exceptions HOT 2
- Default fallback on null instead of error (unless not defined in configuration)
- use with Angular i18n
- Set dynamic meta tags to use api call
- Allow use of ngx-meta in angular 8 project HOT 3
- Do you have any plan to apply for angular8? HOT 2
- Angular v9 support HOT 4
- The title does not display correctly in the browser history
- AOT Compiling Error - Function calls are not supported in decorators but 'MetaModule' was called HOT 7
- @ngx-meta/core Doesn't support Angular 11.X.X HOT 11
- Setting Tags from ts file.
- Linked-In Social Share issue HOT 1
- Uncaught TypeError: Cannot read property 'core' of undefined at ngx-meta-core.umd.js:4 HOT 1
- Angular 11/12 support HOT 6
- after ng update 12 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ngx-meta.