I try to make a see more
button to get more search results at the moment of clicking.
I have my header in separate arrchivos and I use it with:
<ion-header>
<page-header> </page-header>
</ion-header>
For each view.
The button that generates the event is in a search-modal.html
like this:
<div (click)="seeMoreResults($event)">
<button color="primary" block>see more</button>
</div>
And the search-modal.ts
controller looks like this:
Import {Component, EventEmitter, Output} from '@ angular / core';
@Component({
selector: 'page-search-modal',
templateUrl: 'search-modal.html',
})
export class SearchModalPage {
@Output()
public updateSearchResults = new EventEmitter();
seeMoreResults(event) {
this.countSearchResult = Object.keys( this.searchResult ).length; // "this.searchResult" are the search results that arrive when something is typed.
this.updateSearchResults.emit( this.countSearchResult );
}
The header.html
has this:
<ion-toolbar (updateSearchResults)='updateSearchResults($event)'>
// Here is my search bar.
</ion-toolbar>
And my header.ts
has:
updateSearchResults(lastTotal){
this.search((10+lastTotal), lastTotal, true);
// "search" is the method that makes me search and issues the result.
}
The first search is working fine, that's why I omitted the code.
But when I click the "see more" button it does not emit anything, I tried to put a console.log("Run");
inside updateSearchResults
of header.ts
but never prints.
Any idea why it is?
Sorry for the translation, I speak Spanish.