I tried to make a search system like this
<input type="text" class="form-control" placeholder="search product)" #searchValue/>
<span class="input-group-btn">
<button class="btn btn-green" [routerLink]="['/search-result']" [queryParams]="{ q: searchValue.value}" >
<i class="fa fa-search fa-md"></i>
</button>
</span>
Assume than I already write 'Search' in the input tag and then I click the button. The result url
/search-result?q=
If I clicked again it will give a right url
/search-result?q=Search
If I change the input value (Search) before I click the button again, example I change it into 'Searching'. The result is
/search-result?q=Search
and need to clicked once again to get
/search-result?q=Searching
So it overdue by one request. Why is this happening? I tried to move the [routerLink]
to span
tag but it still the same. Any Idea how to fix it?
Thanks :)