Title Service

Used to set page title, generally listen for route changed and refresh title, for example: app.component.ts; The default data from MenuService.

Suggest: Set the prefix or suffix value via Angular startup service (startup.service.ts).


Get the title value according to the following order:

  1. Routing configuration `{ data: { title: 'page name', titleI18n: 'page-name' } }

  2. Parse the menu data based on the current URL

  3. Get h1 content in page alain-default__content-title or page-header__title

  4. Default title


defaultpropertyDefault title of document title
prefixpropertyPrefix of document title
suffixpropertySuffix of document title
reversepropertyWhether to reverse
setTitle(title?: string | string[])methodSet the document title, will be delay 25ms, pls refer to #1261
setTitleByI18n(key: string, params?: Object)methodSet i18n key of the document title