I am trying to make that when the button to create the component is pressed, change the variable, or load the new title that is shown through the variable "gestion", which I want to show ... it seems that it does but when it loads the content of the component that the button calls, the value changed in the last step does not remain ... help
I went back to write the code, in another way and even so, it seems as if I made the change, both of the "state" function and the "change" function, however the page refreshes and shows again what it is by default, the changes do not remain ...
Here the .TS
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-sidebar',
templateUrl: './sidebar.component.html',
styleUrls: ['./sidebar.component.css']
})
export class SidebarComponent implements OnInit {
constructor() { }
ngOnInit() {
}
gestion:string="Gestion de Proyecto";
cambio():void{
this.gestion = "Gestion de Casos de Prueba";
}
isOn: boolean ;
estado(): void {
this.isOn = true;
}
}
Here the .HTML
<ul class="list-unstyled components ">
<p><a href="">{{gestion}}</a></p>
<li class="active">
<a href="#homeSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">Herramientas</a>
<ul class="collapse list-unstyled" id="homeSubmenu">
<li>
<a href="crear">Crear</a>
</li>
<li>
<a (click)="estado()"(click)="cambio()" href="modificar">Modificar</a>
</li>
<li>
<a href="#">Eliminar</a>
</li>
</ul>
</ul>
<a *ngIf="!isOn"> <app-barrasearch></app-barrasearch></a>
<a *ngIf="isOn"><app-barraproyecto></app-barraproyecto></a>