Answer the question
In order to leave comments, you need to log in
AngularJS: How to filter object (Error: [filter:notarray])?
Greetings!
There is a data object for forming a select tag through angular.
{
"78-1":{
"ID":"78-1",
"name":"Group 1: №1",
"buyed":false,
"disable":false
},
...
}
<select ng-model="row.ID" ng-options="row_item.ID as row_item.name disable when row_item.disable for row_item in app.data.rows | filter:rowDisabled" class="form-control"></select>
BilCtrl.rowDisabled = function() {
return function (rows) {
var result = {};
angular.forEach(rows, function(row, key) {
row.disable = false;
if( row_item.buyed )
row.disable = true;
for( var i in BilCtrl.rows ){
if (!BilCtrl.rows.hasOwnProperty(i))
continue
if( BilCtrl.rows[i].ID == row.ID )
row.disable = true;
}
result[key] = row;
});
return result;
};
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question