0

I want to make a search box like Google for my web page:

enter image description here

I came across this question: Google-like search box with an AngularJS directive

In the accepted solution, I'm not able to understand how (from where) data is populating as soon as user start typing in search text box. also where the on-change event is handled for textbox.

Can please anyone help me with this?

Community
  • 1
  • 1
Devesh Agrawal
  • 8,982
  • 16
  • 82
  • 131
  • Data gets populated from the Json file that is being provided in the plunker.This is the one if (SearchService.typeOfSearch == "web") { requestUrl = "results-web.json"; } else if (SearchService.typeOfSearch == "image") { requestUrl = "results-image.json"; } – Reena Apr 10 '15 at 04:20
  • @Reena, you sure about that. When you type 'a' you get almonds as suggestion. there is no almonds present in results-web.json. its only [ "item1", "item2", "item3", "item4", "item5" ] My doubt is from where almonds is coming? – Devesh Agrawal Apr 10 '15 at 04:32
  • Whiel doing search I'm getting Search Result: item1, Search Result: item2 so on....... I didn't get any other value. R u talking about the plunker provided in that link Wright??? – Reena Apr 10 '15 at 04:39
  • dont press search button, just type 'a' and wait. – Devesh Agrawal Apr 10 '15 at 04:42
  • Sorry still didn't get can you plz provide the screen shot Now I'm also curios to know about it – Reena Apr 10 '15 at 04:44
  • added. u can check now – Devesh Agrawal Apr 10 '15 at 04:48
  • It's pre-filling from your browser's form-fill history. You've typed "almonds" into a text field with name "q" before. – Phil Apr 10 '15 at 04:51
  • Sorry to say but this is not the search result..It is the browser functionality – Reena Apr 10 '15 at 04:52
  • You might have used this value and this value was retain as you get almonds, here in my case I'm getting angularjs... – Reena Apr 10 '15 at 04:53

1 Answers1

0

See this, you will get the idea that it was not the search result.

It will search only on the click of the button as per the functionality provided in the plunker, and it will be searched from the Json file only enter image description here

Reena
  • 1,109
  • 8
  • 16