Skip to content
This repository was archived by the owner on Oct 2, 2019. It is now read-only.

Perhaps a dumb question, but I cannot find the base use case. #934

Closed
nicklasb opened this issue May 18, 2015 · 4 comments
Closed

Perhaps a dumb question, but I cannot find the base use case. #934

nicklasb opened this issue May 18, 2015 · 4 comments

Comments

@nicklasb
Copy link

And I have looked everywhere in the documentation and examples, or at least I think so.
I have a model that is array of items:

model = ["item1", "item2", "item3"]

The lookup values I have are subsequently something like:

lookupValues = [
  {value: "item1", name: "itemName1},
  {value: "item2", name: "itemName2},
  {value: "item3", name: "itemName3}
]

I want to have a multiselect that updates the model based on the lookup value i select.
To me, that would seem like the most basic use of this component, yet all I see are examples of selecting and adding from a model with the actual objects, which to me basically never would be something I would do, I would always work with Id:s.
For comparison, this is the base use case for angular-strap-select.

I am sure that I have missed something, or do I have to write some translation-mechanism between ui-select and the model? It would be unfortunate as it would break how the model-view relationship should work as changes in the model would not be naturally propagated to ui-select.

@Luddinus
Copy link

@nicklasb maybe this helps: #701

@nicklasb
Copy link
Author

I am not sure what you mean, isn't that issue with a model that contains the drop down value/name-objects? It seems to me that it would be the opposite of what I am after, a solution where the model contains only the values?

@nicklasb
Copy link
Author

Ok, I see what you mean.
I am not sure if the deep-copy thing is applicable to string-values. String values aren't compared by reference as default. I think.

Anyway, if there is no other way to handle this case, it should be possible to specify how the match is made, some callback, perhaps.

@wesleycho
Copy link
Contributor

The template could be overwritten and one could plug in a custom highlight filter.

Going to close as a use issue, feel free to open a new issue if this is not quite right with more details such as a Plunker and instructions as to how the behavior is not quite what is desired.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants