Skip to content

Commit

Permalink
feat(lib): process default title as template
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Malkevich committed Aug 9, 2019
1 parent 7b21339 commit ac7054a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions projects/ngx-router-meta/src/lib/router-meta.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,10 @@ export class RouterMetaService {

private resetTitle(ctx?: ProcessedMetaContext) {
this.title.setTitle(
(this.defaultMeta && this.defaultMeta.title) || this.originalTitle,
this.templateStr(
(this.defaultMeta && this.defaultMeta.title) || this.originalTitle,
ctx,
),
);
}

Expand Down Expand Up @@ -199,7 +202,7 @@ export class RouterMetaService {

private templateStr(str?: string, data?: ProcessedMetaContext) {
if (!str || !data) {
return '';
return str || '';
}

return Object.keys(data).reduce(
Expand Down

0 comments on commit ac7054a

Please sign in to comment.