Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support to Typeahead with object #64

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

AbraaoAlves
Copy link

#53

Like auto complete in ui.bootstrap, objects in array are rendered with toString method.
Ex:

var citys = [{id:1, name:'Berlin', toString(){ return thi.name}, {id:2, name:'London', toString(){ return this.name9o9}]
$scope.availableSearchParams = [
      { key: "name", name: "Name" },
      { key: "city", name: "City", suggestedValues: cities }
];

Or optionally you can use suggestedToString function to render suggestedValues, like this:

var citys = [{id:1, name:'Berlin'}, {id:2, name:'London'}]
var myToString = function(item){ return item.name };
$scope.availableSearchParams = [
     { key: "name", name: "Name" },
     { key: "city", name: "City", suggestedValues: cities, suggestedToString: myToString }
];

using toString native function by default or parameter custom function setted via searchParam
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant