填写这份《一分钟调查》,帮我们(开发组)做得更好!去填写Home

Title

可以用来获取和设置当前 HTML 文档标题的服务。

A service that can be used to get and set the title of a current HTML document.

查看"说明"...

      
      class Title {
  getTitle(): string
  setTitle(newTitle: string)
}
    

说明

由于 Angular 应用程序不能在整个 HTML 文档(<html> 标签)上引导,因此无法绑定到 HTMLTitleElementtext 属性(即 <title> 标签)。可以改用此服务来设置和获取当前标题值。

Since an Angular application can't be bootstrapped on the entire HTML document (<html> tag) it is not possible to bind to the text property of the HTMLTitleElement elements (representing the <title> tag). Instead, this service can be used to set and get the current title value.

方法

获取当前 HTML 文档的标题。

Get the title of the current HTML document.

getTitle(): string
      
      getTitle(): string
    
参数

没有参数。

返回值

string

设置当前 HTML 文档的标题。

Set the title of the current HTML document.

setTitle(newTitle: string)
      
      setTitle(newTitle: string)
    
参数
newTitle string