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

329
Views
angular template ngif not work before reload page

I'm facing a strange problem. I'm using angular 12 and after rendering, the page doesnt show the ngIF template. the input only loads after I reload the page

...imports

@Component 
...
export class VideoUploadComponent implements OnInit { 
 ... 
variables
...
  isFile: boolean= true;
 
  constructor(
   ...
  ) {
    
    this.isFile = true;
  }

  ngOnInit() {

  }

...
Component functions
...

  
  onRadioboxChange(event: any) {
    this.isFile = !this.isFile;
    console.log(this.isFile);
  }

  
}

here is the html

  <form
    ...
  >
   ...
          
          <input
           ...
            (change)="onRadioboxChange($event)"
          />
          <label class="btn btn-outline-primary" for="url">Endereço</label>
        </div>

        <div class="mb-3 mx-auto">
          <div *ngIf="isFile; else endereco">
            ...
              />
            </div>
          </div>
        </div>

        <ng-template #endereco>
           ...
          </div>
        </ng-template>
      </div>
      <div class="form-item">
      ...
  </form>
</div>

before reload antes do carregamento

after reload the page enter image description here

can someone help me with this issue?emphasized text

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

problem solved.

the *ngIf was not showing the content becouse i was not using routerLink for navigate to the page

before

<li>
 <a class="dropdown-item nav-item" href="#/upload"**>
  Cadastrar</a>
 </li>

Solution:

<li>
<a class="dropdown-item nav-item" [routerLink]="['/upload']">
Cadastrar</a>
 </li>
about 4 years ago · Santiago Trujillo 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!