ionic-modal-select
ionic-modal-select copied to clipboard
Data list not getting loaded when using has-search="true" attribute with data loaded from SQLITE
HTML
<button class="button button-positive" modal-select="" ng-model="voucherService.AccountName" modal-title="Select a account" options="AccountList" has-search="true" search-properties="['AccountName']"> Select it <div class="option"> {{option.AccountName}} </div> </button>
Controller
$scope.AccountList = [];
$scope.FillAccountList = function () {
var query = "SELECT AccountID, AccountName FROM AccountMaster order by AccountName";
$cordovaSQLite.execute(db, query, []).then(function (res) {
if (res.rows.length > 0) {
for (var i = 0; i < res.rows.length; i++) {
$scope.AccountList.push({
AccountID: res.rows.item(i).AccountID,
AccountName: res.rows.item(i).AccountName
});
}
} else {
console.log("No results found");
}
}, function (err) {
console.error("error=>" + err);
});
};
$scope.FillAccountList();
Hi, sorry but it's difficult to reproduce this for me. Does your example work if the data is coming from another source?
If data is predefined then it works. But when data are loaded in controller then it fails. You can try to push json data to a list and check.