Reputation: 31
I want to get the text of an input text and saving it in a variable using a button. To use it as a parameter in a query in firebase.
.html
<input type="text" class="form-control" ng-model="value1" id="textCI" placeholder="C.I." >
component.ts
<--ResultCI =valor input text-->
buscarCI(){
let query=null;
query=this.servicio.getUsuarioFiltro(this.ResultCI);
query.snapshotChanges()
.map(changes=>{
return changes.map(c=>({key:c.payload.key, ...c.payload.val()}))
}).subscribe(contactos =>{
this.contactos=contactos
});
}
Upvotes: 2
Views: 11346
Reputation: 222582
You are using the angularjs syntax which is ng-model, instead you should use [(ngModel)]
<input type="text" class="form-control" [(ngModel)]="value1" id="textCI" placeholder="C.I." >
you should be able to access in the component with this.value1
Upvotes: 4