當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。