本文整理匯總了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();
}