本文整理匯總了TypeScript中angular2/platform/browser.Title.getTitle方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Title.getTitle方法的具體用法?TypeScript Title.getTitle怎麽用?TypeScript Title.getTitle使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類angular2/platform/browser.Title
的用法示例。
在下文中一共展示了Title.getTitle方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: constructor
constructor(builder: FormBuilder, title: Title) {
this.appForm = builder.group({
name: ['My Angular2 App', Validators.required]
});
this.titleService = title;
this.pageTitle = title.getTitle();
}
示例2: it
it('should set a title on the injected document', () => {
titleService.setTitle('test title');
expect(DOM.getTitle()).toEqual('test title');
expect(titleService.getTitle()).toEqual('test title');
});
示例3: expect
() => { expect(titleService.getTitle()).toEqual(initialTitle); });
示例4: getTitle
public getTitle(): string {
return this.titleService.getTitle();
}