- Hello everyone, im trying to put bootstrap modal working with angularfire2 but im having a error. It doesnt recognize the data that cames from the DB.
<button *ngFor="let utilfaq of (utilfaqsStream | async) | reverse" class="panel panel-default" type="button" class="btn btn-primary" data-toggle="modal" data-target=".bs-example-modal-lg">Large modal</button>
<div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="panel-body" >
<td><h5><b>Tema</b></h5>{{utilfaq.tema}}</td>
<hr>
<td><h5><b>Subtema</b></h5>{{utilfaq.subtema}}</td>
<hr>
<td><h5><b>Erro</b></h5>{{utilfaq.erro}}</td>
<hr>
<td><h5><b>Solução</b></h5>{{utilfaq.solucao}}</td>
</div>
</div>
</div>
</div>
This is the HTML where i have the Bootstrap modal.
import { Component } from '@angular/core';
import { AngularFireDatabase, FirebaseListObservable, FirebaseObjectObservable } from 'angularfire2/database';
import { Subject } from 'rxjs/Subject';
import { moveIn, moveInLeft, fallIn } from '../router.animations';
interface utilfaq {
erro: string;
solucao: string;
programa:string;
tema:string;
subtema:string;
$key?: string;
}
@Component({
selector: 'app-utilss',
templateUrl: './utilsst.component.html',
styleUrls: ['./utilsst.component.css'],
})
export class UtilsstComponent {
readonly errosPath = "erros";
formutilfaq: utilfaq = {
'erro' : '',
'solucao' : '',
'programa' : '',
'tema' : ',',
'subtema' : ',',
};
utilfaqsStream: FirebaseListObservable <utilfaq[]>;
constructor(db:AngularFireDatabase){
this.utilfaqsStream = db.list('/erros/', {
query: {
orderByChild: 'programa',
equalTo: 'UtilSST'
}
});
}
}
And this is .ts file where i have the db config.
The error im getting is
ERROR TypeError: Cannot read property 'tema' of undefined
at Object.eval [as updateRenderer] (UtilsstComponent.html:22)
at Object.debugUpdateRenderer [as updateRenderer] (core.es5.js:13146)
at checkAndUpdateView (core.es5.js:12293)
at callViewAction (core.es5.js:12653)
at execComponentViewsAction (core.es5.js:12585)
at checkAndUpdateView (core.es5.js:12294)
at callViewAction (core.es5.js:12653)
at execEmbeddedViewsAction (core.es5.js:12611)
at checkAndUpdateView (core.es5.js:12289)
at callViewAction (core.es5.js:12653)
View_UtilsstComponent_0 @ UtilsstComponent.html:22
UtilsstComponent.html:22 ERROR CONTEXT DebugContext_
View_UtilsstComponent_0 @ UtilsstComponent.html:22
I have no idea why is this happening, if i have the data outside the modal it works.... can someone solve this problem ?