Comments (8)
I can imagine examples where they do want to match also for strings that are in the middle of a word. There's no good example I can think of right now in English, but in German there are many words that are consisting of two words... like "Zeitgeist", and if you search for "Geist" you maybe also want to see "Zeitgeist" as a suggestion.
from allmighty-autocomplete.
In spanish is very common. Have you got an idea of what can be the approach to that? I will give a try
j.mobile
On Fri, Jun 13, 2014 at 8:59 AM, Goscha Graf [email protected]
wrote:
I can imagine examples where they do want to match also for strings that are in the middle of a word. There's no good example I can think of right now in English, but in German there are many words that are consisting of two words... like "Zeitgeist", and if you search for "Geist" you maybe also want to see "Zeitgeist" as a suggestion.
Reply to this email directly or view it on GitHub:
#34 (comment)
from allmighty-autocomplete.
Hi J0an,
Ideally, you should do this from the source of the data, but you can also filter it using the on-type attribute.
You can use a regular expression to filter the source. Maybe with \b, to match only the words staring with the typed value. (example)
from allmighty-autocomplete.
hey @davidmh, thanks for the example.
but, i don't know how to apply to the autocomplete filter :(
from allmighty-autocomplete.
I was suggesting to apply it to the source of the data or to the function invoked by the on-type attribute, not directly into the filter.
Do you have a live version I can check? Maybe I can give a more detailed solution.
from allmighty-autocomplete.
yes http://movistar.cuomatest.com/atencion-al-cliente/index2.html#/
j.
On Mon, Jun 23, 2014 at 3:38 PM, Chuck [email protected] wrote:
I was suggesting to apply it to the source of the data or to the function
invoked by the on-type attribute, not directly into the filter.Do you have a live version I can check? Maybe I can give a more detailed
solution.—
Reply to this email directly or view it on GitHub
#34 (comment)
.
from allmighty-autocomplete.
I rewrote the SearchFormController to make it work like you want, but there are a few things you should consider on your implementation.
I've added some comments, but you can read more about it on a similar issue
.controller("SearchFormController", function($scope, $http, $filter, Suggest) {
var all_suggestions = [];
$scope.suggestions = [];
Suggest.query(
function(data) {
// Asking for all the suggestions from the start it's an overkill.
// For this particular case, we can store all the suggestions on a
// scoped variable, since they are not needed yet.
all_suggestions = data.data;
}
);
$scope.doSuggest = function(query){
// The suggestions should be requested here, passing the typed query to
// the server.
// But since we already have requested all possible suggestions, we'll
// filter the matches here.
$scope.suggestions = $filter('filter')(all_suggestions, function (value) {
// We only want the suggestions starting with the typed word
var exp = new RegExp("\\b" + query, "gi");
return exp.test(value);
});
};
})
from allmighty-autocomplete.
i love you @davidmh :)
from allmighty-autocomplete.
Related Issues (20)
- Not losing focus
- Support ng-disabled
- Pass id into on-type
- work like gmail or another email client
- Is it possible to show all list on initial focus or when suggestion is null?
- ng-enter search
- Closes the scrollable list of items if you click on scroll button HOT 2
- Read-Only & Disabled?
- suggestion problem
- Doesn't with array of objects HOT 1
- Add input-type=search (configureable)
- Disable spellcheck on mobile devices
- want to clear value in input type HOT 1
- How i can get the value ?
- tabindex not working
- Can multiple select?
- How I use ng-change?
- what modification required for using within ng-repeat
- getting console error on typing in autocomplete text box HOT 1
- any body implemented Add new item when no result found HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from allmighty-autocomplete.