本文整理汇总了TypeScript中@angular/platform-browser.Title.getTitle方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Title.getTitle方法的具体用法?TypeScript Title.getTitle怎么用?TypeScript Title.getTitle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@angular/platform-browser.Title
的用法示例。
在下文中一共展示了Title.getTitle方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: updateTitle
/**
* update the window title using params in the following
* precendence
* 1. titleKey parameter
* 2. $state.$current.data.pageTitle (current state page title)
* 3. 'global.title'
*/
updateTitle(titleKey?: string) {
if (!titleKey && this.titleService.getTitle() ) {
titleKey = this.titleService.getTitle();
}
this.translateService.get(titleKey || 'global.title').subscribe(title => {
this.titleService.setTitle(title);
});
}
示例2: it
it('should set the page title', () => {
const titleService: Title = TestBed.get(Title);
const fixture = TestBed.createComponent(PersonFilesComponent);
fixture.detectChanges();
expect(titleService.getTitle()).toContain('John Doe: Documents');
});
示例3: it
it('should have a title 404 Lokalak Search - Page Not Found', () => {
const fixture = TestBed.createComponent(PageNotFoundComponent);
fixture.detectChanges();
const component = fixture.debugElement.componentInstance;
termsTitle = TestBed.get(Title);
expect(termsTitle.getTitle()).toBe('404 Lokalak Search - Page Not Found');
});
示例4: it
it('should have a title Loklak Terms of Service', () => {
const fixture = TestBed.createComponent(TermsComponent);
fixture.detectChanges();
const component = fixture.debugElement.componentInstance;
termsTitle = TestBed.get(Title);
expect(termsTitle.getTitle()).toBe('Loklak Terms of Service');
});
示例5: it
it('should have a title Contact Loklak', () => {
const fixture = TestBed.createComponent(ContactComponent);
fixture.detectChanges();
const component = fixture.debugElement.componentInstance;
contactTitle = TestBed.get(Title);
expect(contactTitle.getTitle()).toBe('Contact Loklak');
});
示例6: it
it('should have a title Welcome to Loklak Privacy Policy', () => {
const fixture = TestBed.createComponent(PrivacyComponent);
fixture.detectChanges();
const component = fixture.debugElement.componentInstance;
privacyTitle = TestBed.get(Title);
expect(privacyTitle.getTitle()).toBe('Loklak Privacy Policy');
});
示例7:
.then(() => {
// set Page Title
if (this.title.getTitle() !== application.page.title) {
this.title.setTitle(application.page.title);
}
this.alertService.showSnackBar('success', 'general.applications.updateMessage');
},
示例8:
).do((selectedItems) => {
const course = selectedItems[0];
const paper = selectedItems[1];
const exam = selectedItems[2];
const title = `${course.code || ''} ${paper.name || ''} ${exam.year || ''} ${exam.semester || ''}`;
const oldTitle = this.title.getTitle();
if (title.trim() === '') {
if (oldTitle !== defaultTitle) {
this.title.setTitle(defaultTitle);
}
} else {
if (title !== oldTitle) {
this.title.setTitle(title);
}
}
});
示例9: constructor
constructor(
private router: Router,
private title: Title
){
console.log(title.getTitle());
let tmp = 'WeLoading';
let i = 0;
setInterval(()=>{
if(i < 3){
tmp += '.';
i++;
} else {
tmp = 'WeLoading';
i = 0;
}
title.setTitle(tmp);
}, 1000)
}
示例10:
).subscribe((selectedItems) => {
let course = selectedItems[0];
let paper = selectedItems[1];
let exam = selectedItems[2];
let title = `${course ? course.code : ''} ${paper ? paper.name : ''} ${exam ? exam.year : ''} ${exam ? exam.semester : ''}`;
let oldTitle = this.title.getTitle();
let equalTitles = title === oldTitle;
if (title.trim() === '') {
if (oldTitle !== defaultTitle) {
this.title.setTitle(defaultTitle);
}
} else {
if (title !== oldTitle) {
this.title.setTitle(title);
}
}
});
示例11: pageTrack
/**
* Track Page in Clicky
*
* @param path location
*
* @link https://clicky.com/help/custom/manual#log
*/
pageTrack(path: string) {
const title: string = this.titleService.getTitle();
clicky.log(path, title, 'pageview');
}
示例12: ngOnInit
ngOnInit() {
this.originalTitle = this.title.getTitle();
this.title.setTitle(pageNotFoundTitle);
}
示例13: it
it('should set a title on the injected document', () => {
titleService.setTitle('test title');
expect(getDOM().getTitle()).toEqual('test title');
expect(titleService.getTitle()).toEqual('test title');
});
示例14: expect
() => { expect(titleService.getTitle()).toEqual(initialTitle); });
示例15: getTitle
public getTitle(): string {
return this.titleService.getTitle();
}