Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions packages/platform-browser/src/browser/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Inject, Injectable} from '@angular/core';
import {Inject, Injectable, inject} from '@angular/core';

import {DomAdapter, getDOM} from '../dom/dom_adapter';
import {DOCUMENT} from '../dom/dom_tokens';



/**
* Represents a meta element.
*
Expand All @@ -29,12 +30,19 @@ export type MetaDefinition = {
[prop: string]: string;
};

/**
* Factory to create Meta service.
*/
export function createMeta() {
return new Meta(inject(DOCUMENT));
}

/**
* A service that can be used to get and add meta tags.
*
* @experimental
*/
@Injectable({providedIn: 'root'})
@Injectable({providedIn: 'root', useFactory: createMeta, deps: []})
export class Meta {
private _dom: DomAdapter;
constructor(@Inject(DOCUMENT) private _doc: any) { this._dom = getDOM(); }
Expand Down
10 changes: 8 additions & 2 deletions packages/platform-browser/src/browser/title.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,17 @@
* found in the LICENSE file at https://angular.io/license
*/

import {Inject, Injectable} from '@angular/core';
import {Inject, Injectable, inject} from '@angular/core';

import {getDOM} from '../dom/dom_adapter';
import {DOCUMENT} from '../dom/dom_tokens';

/**
* Factory to create Title service.
*/
export function createTitle() {
return new Title(inject(DOCUMENT));
}

/**
* A service that can be used to get and set the title of a current HTML document.
Expand All @@ -22,7 +28,7 @@ import {DOCUMENT} from '../dom/dom_tokens';
*
* @experimental
*/
@Injectable({providedIn: 'root'})
@Injectable({providedIn: 'root', useFactory: createTitle, deps: []})
export class Title {
constructor(@Inject(DOCUMENT) private _doc: any) {}
/**
Expand Down