I need to retrieve all selected results for use in my controller.
<div class="form-group" ng-repeat="att in arr track by $index" ng-hide="check">
<div class="col-md-3">
<label for="phone">{{att.name}}</label>
</div>
<div class="col-md-9">
<select class="form-control" ng-model="user.charactValue" multiple="true">
<option ng-repeat="itemss in att.value track by $index" value="{{itemss}}" >{{itemss}}</option>
</select>
<div class="text-center"><a data-toggle="modal" data-target="#addNewCharacteristic" ng-click="getObj(att)">Add</a></div>
</div>
</div>
<input type="submit" ng-click="companyBusinessAsset">
$scope.companyBusinessAsset = function() {
console.log ($scope.charactValue);
// this returns Undefined
};
The following code is being used, but it always enters the 'if' statement.
$scope.charactValue = [];
$scope.$watch ('selected', function(nowSelected) {
$scope.selectedValues = [];
console.log(nowSelected)
// this returns Undefined
console.log('dddd')
if (!nowSelected) {
console.log("IFFFFFF");
return;
}
angular.forEach ($scope.charactValue, function(val) {
console.log(val);
$scope.charactValue.push (val.id.toString());
});
});