当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Title.getTitle方法代码示例

本文整理汇总了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);
        });
    }
开发者ID:bonhamcm,项目名称:generator-jhipster,代码行数:17,代码来源:_language.helper.ts

示例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');
  });
开发者ID:Ninja-Squad,项目名称:globe42,代码行数:7,代码来源:person-files.component.spec.ts

示例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');
	});
开发者ID:eddygta17,项目名称:loklak_search,代码行数:7,代码来源:pagenotfound.component.spec.ts

示例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');
	});
开发者ID:eddygta17,项目名称:loklak_search,代码行数:7,代码来源:terms.component.spec.ts

示例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');
	});
开发者ID:eddygta17,项目名称:loklak_search,代码行数:7,代码来源:contact.component.spec.ts

示例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');

	});
开发者ID:eddygta17,项目名称:loklak_search,代码行数:8,代码来源:privacy.component.spec.ts

示例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');
      },
开发者ID:Meistercoach83,项目名称:sfw,代码行数:8,代码来源:settings.component.ts

示例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);
        }
      }
    });
开发者ID:Toxicable,项目名称:PassPast,代码行数:18,代码来源:current-data.service.ts

示例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)
 }
开发者ID:Richard-Feng,项目名称:BlockChain,代码行数:18,代码来源:loading.component.ts

示例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);
        }
      }

    });
开发者ID:Toxicable,项目名称:PassPast,代码行数:20,代码来源:app.component.ts

示例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');
 }
开发者ID:catrielmuller,项目名称:angulartics2,代码行数:11,代码来源:clicky.ts

示例12: ngOnInit

 ngOnInit() {
   this.originalTitle = this.title.getTitle();
   this.title.setTitle(pageNotFoundTitle);
 }
开发者ID:kevinphelps,项目名称:kevinphelps.me,代码行数:4,代码来源:not-found.component.ts

示例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');
 });
开发者ID:JanStureNielsen,项目名称:angular,代码行数:5,代码来源:title_spec.ts

示例14: expect

 () => { expect(titleService.getTitle()).toEqual(initialTitle); });
开发者ID:JanStureNielsen,项目名称:angular,代码行数:1,代码来源:title_spec.ts

示例15: getTitle

 public getTitle(): string {
   return this.titleService.getTitle();
 }
开发者ID:KonarKorona,项目名称:flowchat,代码行数:3,代码来源:seo.service.ts


注:本文中的@angular/platform-browser.Title.getTitle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。