In an angular application, I used ordinary input earlier:
<input type="text" class="form-control input-sm" name="type" ng-model="flat.flatData.type_local" placeholder="Type" required> There is a need to use select instead of some input. For this, I installed angular ui-select and now instead of the above input I have ui-select:
<ui-select ng-model="flat.flatData.type_local" on-select="someFunction(item, model)" theme="bootstrap"> <ui-select-match placeholder="Type"> {{ $select.selected.type }} </ui-select-match> <ui-select-choices repeat="t in flat.type_local | filter: $select.search"> <div ng-bind-html="t.type | highlight: $select.search"></div> </ui-select-choices> </ui-select> My controller looks like this:
angular.module('flatCtrl', ['flatService', 'ui.grid', 'ui.grid.resizeColumns', 'ui.grid.moveColumns', 'ui.grid.autoResize', 'ngSanitize', 'ui.select']) .controller('FlatController', function(Flat, socketio){ vm = this; vm.type_local = {}; vm.createFlat = function(){ vm.message = ''; Flat.create(vm.flatData) .success(function(data){ // clear up the form vm.flatData = ''; vm.message = data.message; }); }; vm.type_local = [ { type: 'One' }, { type: 'Two' } ]; vm.counter = 0; vm.someFunction = function (item, model){ vm.counter++; vm.eventResult = {item: item, model: model}; }; The problem is that in the case of inputs everything works, and their value is successfully written to the MongoDB database. In the case of a select, its value is not recorded in the database, although the values of the remaining inputs are still successfully recorded.