Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Create Title provider #487

Closed
Closed
@gjuchault

Description

@gjuchault

Note: for support questions, please use one of these channels: https://github.com/angular/universal/blob/master/CONTRIBUTING.md#question. This repository's issues are reserved for feature requests and bug reports.

  • I'm submitting a ...
  • bug report
  • feature request
  • support request => Please do not submit support request here, see note at the top of this template.
  • What modules are related to this pull-request
  • express-engine
  • grunt-prerender
  • gulp-prerender
  • hapi-engine
  • universal-preview
  • universal
  • webpack-prerender
  • What is the current behavior?

Error when using Title provider
EXCEPTION: No provider for Title!

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem by creating a github repo.

app.component.ts

export class AppComponent {
  constructor(private title: Title) {
    title.setTitle('Foobar');
  }
}```

main.node.ts
```ts
import {
    ...
    Title
} from 'angular2-universal';

export function ngApp(req: Request, res: Response): void {
  // ...
  const config: BootloaderConfig = {
    ...
    providers: [
      ...
      Title,

main.browser.ts

import { Title } from '@angular/platform-browser';

bootstrap(AppComponent, [
    ...
    Title
]);
  • What is the expected behavior?

No errors, the file should get its <title> tag replaced

  • What is the motivation / use case for changing the behavior?

SEO

  • Please tell us about your environment:
  • Angular version: 2.0.0-RC.4
  • Browser: all
  • Language: all
  • OS: all
  • Platform: NodeJS
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. stackoverflow, gitter, etc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions