I've been working on developing a search feature that utilizes text input to look up information about corporations through a government API (https://github.com/usagov/Corporate-Consumer-Contact-API-Documentation).
Within my project, I have an HTML page named contact-list.component.html which includes a button element. When this button is clicked, it triggers a function located in the component file (contact-list.component.ts). The goal of this function is to utilize the inputted string for conducting a search using a service I've incorporated, with the intention of displaying the results in an array that can be bound to a table.
contact-list.component.html
<div class='row'>
<div class='col-md-2'>Enter Corporation Name:
</div>
<div class="col-md-4">
<input type="text"
[(ngModel)] = 'searchString'/>
<div><button class='btn btn-primary' ng-click="ContactListComponent.getResults(searchString)">Search</button>
</div>
</div>
</div>
<div class='row'>
contact-list.component.ts
getResults(_searchString: string): any{
this._contactService.getContacts(this._searchString)
.subscribe(contacts => this.contacts = contacts,
error => this.errorMessage = <any>error);
}
However, upon testing, I've encountered an issue where no outputs are displayed in the console upon entering text and clicking the button. Even when I simply use console.log("foo"); within the getResults() method, nothing appears in the console after pressing F12. Any insights on what might be causing this discrepancy?