could you please tell me how to edit text of row in angular js.I make a demo in which I create a row dynamically when again I am editing it name of row.But my function not working why ?
here is my code http://codepen.io/anon/pen/KpwzGP Follow this steps.
click the bottom icon left bottom .It show pop up screen write anything and press **add*.It generate a row.when you click edit button it show again a pop up with fill values button when I again press "add" button it should edit or change the text of row .
can we change the text of button also mean while case edit button name is "save"
$scope.showPopup = function() { $scope.data = {}
// An elaborate, custom popup
var myPopup = $ionicPopup.show({
template: '<input type="text" ng-model="data.testcase" style="border: 1px solid red" autofocus>',
title: 'Enter Add Test case',
subTitle: 'Add Test case name',
scope: $scope,
buttons: [
{ text: 'Cancel' },
{
text: '<b>Add</b>',
type: 'button-positive',
onTap: function(e) {
if (!$scope.data.testcase) {
//don't allow the user to close unless he enters wifi password
e.preventDefault();
} else {
return $scope.data;
}
}
},
]
});
myPopup.then(function(res) {
console.log('Tapped!', res);
if(typeof res!='undefined' && !$scope.iseditDone) {
res.edit="ion-edit";
res.close="ion-close";
$scope.items.push(res)
}else if($scope.iseditDone){
}
console.log($scope.items);
});
/* $timeout(function() {
myPopup.close(); //close the popup after 3 seconds for some reason
}, 3000);*/
};
$scope.addTestCase=function(){
$scope.showPopup();
}
$scope.editRow=function(row){
//alert(row.testcase)
$scope.data.testcase=row.testcase;
// alert($scope.data.testcase)
$scope.showPopup();
$scope.data.testcase=row.testcase;
}