Search bar not working second time in header, in portal of servicenow

AbhishekS603265
Tera Contributor

Hi Community,

I'm facing a strange issue in my ServiceNow Service Portal.

I have implemented a custom search bar in the header widget. It works perfectly the first time the search results are fetched and displayed as expected. However, when I try to use the search bar again (second time onwards), nothing happens. It does not trigger any API calls or page updates. It just stays idle, as if no action is being taken.

What I have Checked:

  • The input is correctly captured and bound via ng-model.

  • The ng-click or method bound to the search button is firing the first time only.

  • There are no errors in the browser console.

  • No network request is triggered on the second attempt.

  • I ensured that Angular scope is being updated and digest cycle is triggered.

Environment:

  • Scoped Application

  • Service Portal (custom theme)

  • Using AngularJS (as supported by Service Portal)

  • Search logic is tied to $scope.search() or similar method.

My Suspicions:

  • Could be related to Angular not detecting changes in the model.

  • May need a $timeout, $apply, or $watch logic to force re-evaluation.

  • Possibly the input value is not considered “changed” if the same query is retyped.

Request:

Has anyone experienced something similar with custom widgets in the Service Portal header? How can I make the search bar functional on every use?

Any advice, workaround, or best practice recommendation would be greatly appreciated!

Thanks in advance!

0 REPLIES 0