This a bootstrap twitter, button
this control to data toggle collapse
<button class="btn btn-primary" ....
aria-expanded="false">
this a bootstrap twitter inside of nav-tabs
, this show on button click
<div *ngIf="ifActivoControl('1' + contadorObjet.name)"
class="embed-responsive embed-responsive-16by9">
<iframe class="embed-responsive-item"
src="//www.youtube.com/v/YX.....">
</iframe>
</div>
When angular2 render for the first time this function ifActivoControl('1' + contadorObjet.name)
return false.
This function is to test the not taken seriously
ifActivoControl(test: any): boolean{
let booleanStr = document.getElementById(test).getAttribute('aria-expanded');
let bool: boolean = false;
if(booleanStr === 'false'){
bool = false;
}else{
bool = true;
}
return bool;
}
Return false because aria-expanded="false"
but when this switch to true aria-expanded="true"
, how can I do, ngIf
to check again.
This may not be the best way to do, but it is, as I have tried I hope you understand what I mean.
UPDATE:
I solved after reading this answer by Marcos Rajcok and reading this,
https://angular.io/docs/ts/latest/api/core/ChangeDetectorRef-class.html#!#detach
but I do not know if this is the best way. The first tests I do, it works as expected