Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
Ng If con un booleano - para cambiar el título de una página

En mi página Stock tengo varios campos con un título llamado Title 1 .

ingrese la descripción de la imagen aquí

¡Si hago un console.log estoy en mi primera página!

 ngOnInit() { this.currentPortfolio = this.shrd.getData('currentPortfolio'); this.subPage = 'stocks'; this.sectionTitle = ""; this.pageTitle = "Options"; for (var i = 0; i < this.optionsDropdownFilters.length; i++) { this.issuers.actionsGrouped[this.optionsDropdownFilters[i]] = []; } console.log("First page => Tile 1 : " + JSON.stringify(this.subPage = 'stocks')); this.initiate(); }

En Google Chrome tengo esto: ingrese la descripción de la imagen aquí

Ahora, hago clic en el botón Search en mi página Stock ... Quiero cambiar Title1 a Title2 .

ingrese la descripción de la imagen aquí

Si hago un console.log, estoy en mi segunda página

ingrese la descripción de la imagen aquí

 launchSearchSelected(t) { this.searched = true; this.dateNotValid = false; this.dateDoesntExist = false; if (this.search.equityDate.length == 0) { this.dateDoesntExist = true } if (t == 'A' && this.search.equityOptionCode > 0 && this.search.equityDate.length > 0) { this.launchSearchResult(t, this.search.equityOptionCode, this.search.equityDate); } else if (t == 'I' && this.search.indexOptionCode.length > 0 && this.search.indexDate.length > 0) { this.launchSearchResult(t, this.search.indexOptionCode, this.search.indexDate); } console.log("Second Page => Title 2 " + JSON.stringify(this.searched = true)); }

En mi HTML, no entiendo cómo puedo cambiar de un título a otro con el booleano.

 <ng-container *ngIf="subPage === 'stocks' "> <div class="breadcrumb d-flex justify-content-between"> <h1>Title 1 </h1> </div> </ng-container>
about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Es difícil saber cuál es la mejor manera de proceder sin más información, pero si solo desea cambiar el título en función de la variable this.subPage que tenga el valor " stocks " o no (como parece que lo está intentando), entonces puede hacer esto:

 <ng-container> <div class="breadcrumb d-flex justify-content-between"> <h1 *ngIf="subPage == 'stocks'">Title 1</h1> <h1 *ngIf="subPage != 'stocks'">Title 2</h1> </div> </ng-container>
about 4 years ago · Juan Pablo Isaza Report

0

tengo la solución:

 <ng-container *ngIf="subPage === 'stocks' "> <ng-container *ngIf="spinners.search === true "> <div class="breadcrumb d-flex justify-content-between"> <h1>Title 1 </h1> </div> </ng-container> </ng-container> <ng-container *ngIf="subPage === 'stocks' "> <ng-container *ngIf="spinners.search === false "> <div class="breadcrumb d-flex justify-content-between"> <h1>Title 2 </h1> <button (click)="goBack()" class="btn btn-primary"> Back </button> </div> </ng-container> </ng-container>
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!