Hi Im new in ionic im using the the ng-repeat of the angular.. and I was wondering how to get the name or id when the item of ng-repeat is clicked.. Im using sqlite to get all data.
function UserCtrl($scope, $cordovaSQLite, $location, $state, $cordovaDialogs, $cordovaPreferences) {
var vm = this;
$scope.data = {};
$scope.selection = {catagory : null};
var query = "SELECT * FROM listpeople";
$cordovaSQLite.execute(db, query, [])
.then(function(res) {
if (res.rows.length > 0) {
var userName = _.map(res.rows, 'name');
vm.names = userName;
console.log(userName)
} else {
console.log("No results found");
console.log(res);
}
}, function(err) {
console.error(err);
});
}
my html
<ion-view title="Users" ng-controller="UserCtrl as vm">
<ion-content class="has-header padding">
<div class="list">
<div class="item item-icon-right" ng-repeat="users in vm.names track by $index">
{{users}}
<i class="icon ion-edit" ng-click = "vm.edit()"></i>
</div>
</div>
</ion-content>
</ion-view>