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

ng-model is not getting changed #205

Closed
sanketsaurav opened this issue Sep 19, 2014 · 8 comments
Closed

ng-model is not getting changed #205

sanketsaurav opened this issue Sep 19, 2014 · 8 comments

Comments

@sanketsaurav
Copy link

I'm trying to achieve something very straightforward:

<ui-select multiple ng-model="company.stack" theme="bootstrap">
    <ui-select-match>{$$item.name$}</ui-select-match>
    <ui-select-choices repeat="technology in technologies | filter: $select.search">
        <div ng-bind-html="technology.name | highlight: $select.search"></div>
    </ui-select-choices>
</ui-select>

When changing the objects, the changes are not reflected in the model company.stack. I tried changing it to $parent.company.stack, but it still doesn't work. What am I missing?
I'm using AngularJS v1.3.0-beta.17.

@dmackerman
Copy link

Could be broken with that version of Angular - not sure a lot of this module has been tested with the 1.3.x versions of Angular.

@dimirc
Copy link
Contributor

dimirc commented Oct 8, 2014

@sanketsaurav try creating a plunker so I can check it and help you faster

@tannerlinsley
Copy link

+1 Saw this issue in production after upgrading to angular 1.3.4, Everything multiple looks okay, but model never updates.

Here is a plunker: http://plnkr.co/edit/VdC2ImYaQQJQPw1jsDUV?p=preview
The styles in the plunker are a bit messed up, but the multiple select binding is clearly broken

@derekperkins
Copy link

This is really causing us issues. Any ideas where we can start debugging?

@mmoy92
Copy link

mmoy92 commented Jan 20, 2015

@tannerlinsley It appears you can fix this by manually instantiating the model within the controller (demo.js)

$scope.friends = {};  // Need to instantiate model within controller.

I also had to change the multi-select to hold the field of an ng-model object, instead of the object itself:

<ui-select multiple ng-model="friends.multi" ...>

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

@andorov
Copy link

andorov commented Aug 27, 2015

still appears to be an issue. @mmoy92 's solution worked for me.

@ninrod
Copy link

ninrod commented Oct 28, 2015

@mmoy92 solution worked for me. But it is still an issue as of v0.13.2

@user378230
Copy link
Contributor

As per FAQs ngModel requires dot notation.

Closing.

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

9 participants