How do you pass input value into a function on form submit in Angular 6?
You are doing two way binding in the search bar with var searchValue
so you need to change only pass this var on click of submit.
Just replace your click event
(click)='performSearch(searchBar.value)' to
(click)='performSearch(searchValue)'
If you are working with a piece that needs to pass it's own value into a method, this will do the trick:
<input type="number" value="{{myValue}}" (change)="updateMyValue($event.target.value)">
This is because you are sending the event object on form submit, so you'll get the complete Event object.
(ngSubmit)='performSearch($event)'
If you just want one value, use your template reference variable of input as you are using in click event,
(ngSubmit)='performSearch(searchBar.value)'