Im trying to create bootstrap Togglable tabs from data that I get from static json file I'm loading on component init. For the tabs I need to generate random id for the tabpanel and for href attribute on tablist.
What I get as a result WORKS but I do see this error in the console:
ERROR Error: ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: 'j5e0vxl5-lua'. Current value: 'j5e0vxlz-5xl'.
at viewDebugError (core.es5.js:8418)
at expressionChangedAfterItHasBeenCheckedError (core.es5.js:8396)
at checkBindingNoChanges (core.es5.js:8560)
at checkNoChangesNodeInline (core.es5.js:12421)
at checkNoChangesNode (core.es5.js:12395)
at debugCheckNoChangesNode (core.es5.js:13172)
at debugCheckRenderNodeFn (core.es5.js:13112)
at Object.eval [as updateRenderer] (WorkflowComponent.html:116)
at Object.debugUpdateRenderer [as updateRenderer] (core.es5.js:13094)
at checkNoChangesView (core.es5.js:12217)
WorkflowComponent.html
<div class="col-sm-12" [attr.random]="randomText(true)">
<!-- Nav tabs -->
<ul class="nav nav-tabs" role="tablist">
<li role="presentation">
<a [attr.href]="'#random-'+randomText()" [attr.aria-controls]="'random-'+randomText()" role="tab" data-toggle="tab">
<strong>Tab name</strong>
</a>
</li>
</ul>
<!-- Tab panes -->
<div class="tab-content">
<div role="tabpanel" class="tab-pane" [attr.id]="'random-'+randomText()">
<div>
<p>Tab content</p>
</div>
</div>
</div>
</div>
workflow.components.ts randomText method
randomText(generateRndmText = false) {
if ( generateRndmText ) {
this._rndmText = (Math.random() + (+new Date)).toString(36).replace('.', '-');
}
console.log('RANDOM: ' + this._rndmText);
return this._rndmText;
}