Skip to content
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

new npm package @nglibs/meta no longer update title programmatically #22

Closed
bouchepat opened this issue Feb 27, 2017 · 7 comments
Closed
Assignees
Labels

Comments

@bouchepat
Copy link

[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

  • Angular version: 2.0.X

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

@fulls1z3
Copy link
Owner

Hi @bouchepat, I've recently changed the behavior of @nglibs/meta by using the default values when no meta information supplied for a specific route, but it seems it needs to be checked further.

I could just find an opportunity to review this issue, soon I'll analyze it and come back with results.

@fulls1z3 fulls1z3 added the bug label Mar 2, 2017
@fulls1z3 fulls1z3 changed the title New npm package @nglibs/meta no longer update title programmatically [bug] new npm package @nglibs/meta no longer update title programmatically Mar 2, 2017
@fulls1z3
Copy link
Owner

fulls1z3 commented Mar 3, 2017

Hi @bouchepat, finally I found some time to analyze this issue and made some remarks:

metaFactory not used in AppModule: title, description or other tags will not update programmatically.

When metaFactory is not used, title did not update programmatically. I've fixed this, and publish after when all tests are OK. However, description (and other tags) were updated. With the next update, I'll double check this failure and it would be nice if we could share our results then.

metaFactory defined and used in AppModule: only the title won't update if set programmatically. Title remains the default set from the factory.

Did not test this case totally, but will update soon.

@fulls1z3
Copy link
Owner

fulls1z3 commented Mar 6, 2017

Hi @bouchepat, finally I've finished tasks with the issue. I have several remarks according to the steps to reproduce:

metaFactory not used in AppModule: title, description or other tags will not update programmatically.

When metaFactory is not used;

  • title does not update programmatically: It has been fixed.
  • description and other tags do not update programmatically: they do, no need to fix.

metaFactory defined and used in AppModule: only the title won't update if set programmatically. Title remains the default set from the factory.

  • only the title does not update programmatically: No, description and other tags do not update programmatically too, but it has been fixed.

Currently, checking the changes in aligning with the current workflow. I hope I can publish the latest commit within the day.

@chrillewoodz
Copy link

So is this fixed? Because I'm finding that I can't set metadata through router nor programmatically..

@fulls1z3
Copy link
Owner

Hi @chrillewoodz, could you please provide more information about your problem - or it's already written in the issue #27?

@chrillewoodz
Copy link

It's in issue 27. I can't wrap my head around why it wouldn't be working.

@fulls1z3
Copy link
Owner

Thanks @chrillewoodz, I wrote on #27 that I'll analyze this asap.

@fulls1z3 fulls1z3 added this to the v0.2.0-rc.4 milestone Apr 4, 2017
@fulls1z3 fulls1z3 added the v0.2.x label Sep 3, 2017
@fulls1z3 fulls1z3 modified the milestones: v0.2.0, v0.2.0-rc.4 Sep 3, 2017
@fulls1z3 fulls1z3 changed the title [bug] new npm package @nglibs/meta no longer update title programmatically new npm package @nglibs/meta no longer update title programmatically Sep 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants