If you search something in google, you can see that sentence in your next search as a suggestion. We don't need the server side coding to implement this functionality. We can save all those searching key words in HTML5 local storage and show them in next's user search. Here I have implemented this functionality with AngularJS Material UI.

Program Flow

Observe the below diagram for program flow. Whenever user clicks on submit button, add search text to local storage. Whenever user changes the search text, show filtered key words from local storage in auto complete manner 

Markup Code

Here I have highlighted the main code components
  1. searchByEnter will detect user's actions of typing including enter code functionality
  2. searchText is the value of user's input
  3. querySearch(searchText) will return all filtered results
  4. addSearchQueryTORepo is for adding searchText to local storage
<md-autocomplete ng-keyup="searchByEnter($event)" ng-disabled="isDisabled" md-no-cache="noCache" md-selected-item="selectedItem" md-search-text-change="searchTextChange(searchText)" md-search-text="searchText" md-selected-item-change="selectedItemChange(item)" md-items="item in querySearch(searchText)" md-item-text="item" md-min-length="0" placeholder="Enter Some text and click on sumbit">
        <span md-highlight-text="searchText" md-highlight-flags="^i">{{item}}</span>
        No matches found for "{{searchText}}".
<md-button class="md-raised md-primary" ng-click="addSearchQueryTORepo()">Submit</md-button>

JS Code

Observe below code. Here I have highlighted HTML5 local storage related code.
app.controller('AppCtrl', function($scope) {
   $scope.searchByEnter = function($event) {  
     if($event.keyCode == 13) {
       var myEl = angular.element($event.target);
   $scope.addSearchQueryTORepo = function() {
     var lowCaseSearchStr = $scope.searchText.toLowerCase();
     var searchQueries = localStorage.getItem("searchQueries");
     var sQrs = [];
     if(searchQueries != null) {
        sQrs = JSON.parse(searchQueries);
        var sind = sQrs.indexOf(lowCaseSearchStr);
        if(sind != -1) {
          localStorage.setItem("searchQueries", JSON.stringify(sQrs));
        } else {
          localStorage.setItem("searchQueries", JSON.stringify(sQrs));
   $scope.querySearch = function(query) {
     var st = localStorage.getItem("searchQueries");
     if(st!=null) {
         var states = JSON.parse(st);
         $scope.localStrResults = states;
         var searchResults = [];
         var myQuery = query.toLowerCase();
         for(var i=0;i<states.length;i++) {
           if(states[i].toLowerCase().indexOf(myQuery) != -1) {
         return searchResults;   


  1. Thank you for informative instruction. Let me share it in my blog https://app-reviews.org/develop-an-amazing-android-app/ cause my readers are interested in HTML5 update too.

  2. We just need to complete this blog reading and have some new learning ideas. I would like to share this blog with people who are good in research writing services production. It is because we will have new learning concepts and ideas after reading this blog.

  3. The final yr students of the universities are so very busy in their guidance for checks that they do not have time to write an assignment, so they try to lease the specialists like college mission help UK who can provide you with excellently written assignments for them. They Custom Assignment Writing Service within the cut-off date.


  4. A high-standard post with all imperative information about Assignment Help UK services. Looking forward to avail the premium services.

  5. I took a keen interest in reading this blog. The blog was interesting, valuable content was given which is easily readable & understood. I too have a reference of one of the top android app development company where experts are highly compatible and provide unique solutions.

  6. Excellent and nice post. It will beneficial for everyone. Thanks for sharing such a wonderful post. Avail No 1 custom essay writing help UK from certified PhD writers. It is extremely helpful for me. You can email us at info@ukdissertationhelp.co.uk or Phone Number - 020 8144 9988

  7. Very efficiently written information. It will be beneficial to anybody who utilizes it, including me. Keep up the good work. For sure i will check out more posts. This site seems to get a good amount of visitors. auto repair Freehold NJ

  8. thank you.
    โปรโมชั่นGclub ของทางทีมงานตอนนี้แจกฟรีโบนัส 50%
    เพียงแค่คุณสมัคร สล็อตออนไลน์ กับทางทีมงานของเราเพียงเท่านั้น
    สมัครสล็อตออนไลน์ >>> Goldenslot
    สนใจร่วมสนุกกับ คาสิโนออนไลน์ คลิ๊กได้เลย
    มีทั้งคาสิโนออนไลน์ หวยออนไลน์ ฟุตบอลออนไลน์ สล็อตออนไลน์ และอื่นๆอีกมากมาย

  9. Pretty good post. I just stumbled upon your blog and wanted to say that I have really enjoyed reading your blog posts. Any way I'll be subscribing to your feed and I hope you post again soon. Big thanks for the useful info  paintless dent repair

  10. Thanks for taking the time to discuss this, I feel strongly about it and love learning more on this topic. If possible, as you gain expertise, would you mind updating your blog with extra information? It is extremely helpful for me. auto reply text

  11. The wild nature of Albania welcomes you to try the offroad experiences making you feel the adrenaline inside your bones. Discover Albania

  12. Awesome post which you have shared with me, I am working as a marketer, this post will improve my SEO
    dissertation help uk

  13. One of the most important aspect of communication is time especially when making new customers for your business. Real-time communication has become absolutely mandatory with verifications, authentications, notifications and alerts needed to be dispersed instantly which only Programmable SMS can accomplish.

  14. I get all the information from your blog. Keep sharing this type of blog reguarly.If you are looking for assignment help in UK, Then you can contact us:- cs@abassignmenthelp .com

  15. Such a nice blog.
    AppSquadz is known as the best app development service provider company. We have a goal-oriented developers’ team that has managed carefully and punctual to deliver project on time.
    Mobile App Development Company

  16. Such a great piece of content and helpful website! Attractive information on your blog, thank you for taking the time and share with us. Cheap essay writers uk
    delivers high-quality content related to experience. We have experienced professionals who someone write my essay hold highest degree credentials and have vast years of helping the scholars.

  17. A substandard post with all vital information about the best Assignment Help in UK as well as all over world. Looking forward to availing the top-quality services. Kindly visit LiveWebtutors in UK for good Assignment Help services.

  18. Knowing the amount of stress each student undergoes when writing a paper, it is recommended to buy fresh essays so that to ease your academic life.

  19. After a long time, I read a very beautiful and very important article that I enjoyed reading. I have found that this article has many important points, I sincerely thank the admin of this website for sharing it. Get for more information Dent Removal Newport Beach CA

  20. I didn't get a word from the article you posted above. Seriously, it is easier for me to buy pre written essays on the related topic. To be honest, if I had to write it by myself, I wouldn't even know from were to start. This is to complecated.

  21. Writing a college essay can be a challenge. There is a good chance that this is precisely why you have stumbled upon https://writer-elite.com/essay-writing-service/

  22. Our team of Best dissertation writing services in the UK is here to assist you throughout the process and get you done with your dissertation since we understand the complexity of it.

  23. Well, Now you need not to worry about your pending assignment writing.assignment help is one of the best assignment service provider in UK. We are here to give you best assignment help UK based service. Browse our services of assignment help London, Edinburgh, Manchester and Across UK.

  24. Luxury rentals aim to give you an evening of your life with your girl on one side and such a classy ride on the other. Of course, if you intend to use up the back seat of the car with your girl, make sure to hire a discreet chauffeur. luxury car rental



Follow this blog by Email

Popular Posts