Wednesday, 15 August 2012

javascript - Angularjs - Send and Recieve Data Similar to Autocomplete -


I am trying to write the feature in my application in which I have an input field, and to type the user a type However, I need to post a service / method value (each character typed) in my backend code ... then I should expect a JSON object of matching result. For example:

If I type: wi

I should see the details given below:

  Willow air alcohol window William Wilter Whistle  

If I add value to n , for example, see the details given below:

  window  

HTML:

  & lt; Input type = "text" ng-model = "serachTerm" & gt; & Lt; Li ng-repeat = "data in search" & gt; {{Data}} & lt; / Li & gt;  

JS:

This is a service used to obtain data, but each letter is unsure about the type of updates being sent and heard. :

  app.factory ('getDataFactory', function ($ http) {returnData: function (done) {$ http.get ('data.json'). Success (function (data) {Done (;);}) Panic (function (error) {warning ('something is broken')}}}}}}}); Ui Bootstrap should take a look at the instructions made by people.  

This is an autocomplete instruction Handles and sends backend and presents suggestions.

Part up.


No comments:

Post a Comment