[x] bug report => check the README and search github for a similar issue or PR before submitting
[ ] support request => check the README and search github for a similar issue or PR before submitting
[ ] feature request
Current behavior
I recently upgraded the package from @nglibs/metadata to @nglibs/meta: the following issues have been noticed:
- metaFactory defined and used in AppModule: only the title won't update if set programmatically. Title remains the default set from the factory.
- metaFactory not used in AppModule: title, description or other tags will not update programmatically.
- meta info defined in the routes will work as expected. (not an issue)
Here is code to test second issue, to test the first issue I just uncomment the commented code:
AppModule:
// export function metaFactory(): MetaLoader {
// return new MetaStaticLoader({
// pageTitlePositioning: PageTitlePositioning.PrependPageTitle,
// pageTitleSeparator: ' - ',
// applicationName: 'xxx xxxx some awesome company',
// defaults: {
// title: 'Default title',
// description: 'Default description',
// 'og:image': '/images/common/the-logo.png',
// 'og:type': 'website',
// 'og:locale': 'en_CA',
// 'og:locale:alternate': 'en_US'
// }
// });
// }
@NgModule({
imports: [
...,
MetaModule.forRoot(),
// MetaModule.forRoot({
// provide: MetaLoader,
// useFactory: (metaFactory)
// }),
...,
],
exports: [],
declarations: [
AppComponent
],
bootstrap: [
AppComponent
]
})
AppComponent:
export class AppComponent {
constructor(private readonly _meta: MetaService) { }
}
AboutComponent:
export class AboutComponent implements OnInit {
constructor(private readonly _meta: MetaService) {
}
ngOnInit() {
this._meta.setTitle('Page for test'); // <-- no errors but title not set
this._meta.setTag('description', 'Some description'); // <-- no errors but description tag not set
}
}
Expected/desired behavior
No title and description set.
Note: I did not have any problems with the previous version: @nglibs/metadata
Please tell us about your environment:
Windows 7
The app is develop with Meteor.js and Angular2, see below npm dependencies
"dependencies": {
"@angular/common": "2.4.3",
"@angular/compiler": "2.4.3",
"@angular/core": "2.4.3",
"@angular/forms": "2.4.3",
"@angular/http": "2.4.3",
"@angular/platform-browser": "2.4.3",
"@angular/platform-browser-dynamic": "2.4.3",
"@angular/router": "3.4.3",
"@nglibs/meta": "^0.2.0-rc.3",
"@types/chai": "^3.4.35",
"@types/mocha": "^2.2.38",
"@types/node": "^0.0.2",
"angular2-file-drop": "^0.0.5",
"angular2-meteor": "^0.7.1",
"angular2-meteor-accounts-ui": "^1.0.0",
"angular2-meteor-polyfills": "^0.1.1",
"angular2-meteor-tests-polyfills": "^0.0.2",
"babel-runtime": "^6.22.0",
"bcrypt": "^1.0.2",
"bootstrap": "^4.0.0-alpha.6",
"dragula": "^3.7.2",
"gm": "^1.23.0",
"lodash": "^4.17.4",
"meteor-node-stubs": "^0.2.4",
"meteor-rxjs": "^0.3.0",
"ng2-auto-complete": "^0.10.9",
"ng2-dragula": "^1.3.0",
"prerender-node": "^2.7.0",
"reflect-metadata": "^0.1.10",
"rxjs": "^5.2.0",
"spawn-sync": "^1.0.15",
"systemjs": "^0.19.42",
"tether": "^1.4.0",
"toastr": "^2.1.2",
"try-thread-sleep": "^1.0.2",
"tslib": "^1.6.0",
"zone.js": "^0.7.4"
}
Tested on Chrome only