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

Loading Data On Init Into Multi-Search Input Not Working. Possible Workaround inside #374

Closed
ghost opened this issue Nov 5, 2014 · 1 comment

Comments

@ghost
Copy link

ghost commented Nov 5, 2014

I've been saving my model to a service when I leave a page, and loading it back in with the scope. This works fine for ui-select, except for multiple-search inputs. When looking at the scope object on page load, the selected options are there. Once the directive loads, the object that held the selections is an empty array. This is happening because I am setting the options to an empty array on page load, when they are getting emptied, it is somehow clearing out the previous selected items.

I tried setting the options to null or undefined, but ui-select throws a bunch of errors.

I found a work around for now, on line 792 of the Plunker I provided below, I added the line
ngModel.$viewValue = ngModel.$modelValue;

I've tried finding the source of the problem, but had no luck. Adding this line seems to have everything working for now, but I'm not sure if it broke anything else.

http://plnkr.co/edit/Ijygdiux4rAg9RlfOfvw?p=preview

@ghost ghost changed the title Loading Data from Multi-Search Input Fails. Possible Workaround inside Loading Data On Init Into Multi-Search Input Not Working. Possible Workaround inside Nov 5, 2014
@ghost ghost closed this as completed Nov 5, 2014
@ghost
Copy link
Author

ghost commented Nov 5, 2014

#192
issue already documented

This issue was closed.
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

0 participants