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.
For AngularJS there is no difference between ng-app and data-ng-app or ng-controller and data-ng-controller or ng-model and data-ng-model because while compiling HTML page, AngularJS strips data- or x- prefix. Find the URL for reference.
NgModel expects the bound element to have a value property, which div s don't have. That's why you get the No value accessor error. I don't know if the input event is supported on all browsers for contenteditable . You could always bind to some keyboard event instead.
ngModel is a directive which binds input, select and textarea, and stores the required user value in a variable and we can use that variable whenever we require that value. It also is used during validations in a form.
Use the ngModel selector to activate it. It accepts a domain model as an optional Input . If you have a one-way binding to ngModel with [] syntax, changing the domain model's value in the component class sets the value in the view.
I had a similar issue with angular 1.3.14
and ui-select
and a multiple-choice ui-select
directive binding to an array. I was not able to bind the selected items to an array referred to in ng-model
.
I got it to work by wrapping selectedItems
into an object:
$scope.myObj = { selectedItems : []};
...
<ui-select ng-model="myObj.selectedItems" ...>
</ui-select>
Putting selectedItems
directly on the $scope
didn't work for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With