ng-model is not getting changed in ui-select

后端 未结 9 666
太阳男子
太阳男子 2021-01-17 08:45

I\'m trying to achieve something very straightforward:


    {         


        
9条回答
  •  隐瞒了意图╮
    2021-01-17 09:19

    Not sure if you figured this out already, but I was also struggling with this "basic use case" today, being new to AngularJS and all. I'm using Angular 1.2.16 and ui-select 0.8.3, and while everything else worked, I just couldn't get it to update the scope variable employee.selected.

    In my case, the issue was caused by my limited experience with AngularJS. Since ng-model is set to a property of an object (employee, in my case) it had to be initialized first. Adding $scope.employee = {}; into the controller resolved this.

提交回复
热议问题