The functionality to be implemented,
HTML code:
Edit the button code:
<button ng-if= "notetabs[0].active" class= "button Button-icon" ng-click= "Privatenote_edit ()" >{{ Privatenoteeditandcancel}}</button>
List code:
<ion-list show-delete= "Flag.showdelete" > <ion-item ng-repeat= "PrivateNote in privatenotelist " class=" Item item-icon-left item-icon-right " ng-click=" Private_note () "> <i class=" icon ion-ios-list-outline Assertive "></i> {{privateNote.title}} <span class= "Private-time-date" > <i class= "icon ion-ionic ion-share assertive X2b-note-public-share "></i> {{ privatenote.datetime}} </span> <ion-delete-button ng-init= "privatenote.checked = false;" ng-class= "{true: ' Ion-ios-checkmark ', &NBSP;FALSE:&NBSP; ' Ion-ios-circle-outline '}[privatenote.checked] " ng-click=" notechecked (privatenote); " ></ion-delete-button> </ion-item> </ion-list>
Select all, delete code
<a class= "button button-stable button-clear red" ng-click= "SelectAll ()" >{{allSelectOrNot}}</a> <a class= "button button-stable button-clear blue" ng-click= "DeleteAll ()" > Delete </a>
JS Code:
. Controller (' Coursenotectrl ', [' $scope ', ' $state ', ' $location ', ' Course ', ' $ Stateparams ', ' Utilities ', ' constant ', ' appagent ',, ' $window ', ' socialsharing ', function ($scope, $state, $location, course, $stateParams, utilities, constant, appagent, $window, socialsharing) { $scope. Coursenotetitle = socialsharing.gettitle (); // var detailId = $stateParams .courseid; // Course.getcourseinfo (Detailid). Then (function (data) { // $scope. Courseinfo = data; // alert ( Courseinfo.name); // }); $ scope.privatenotelist = [{ title: "My notes 1111111", datetime: "yyyy/mmm/dd hh:mm" }, { title: "My notes 2", datetime: " yyyy/mmm/dd hh:mm " }, { title: "My notes 3", datetime: "YYYY/MMM/DD&NBSP;HH: MM " }, { title: " My notes 4 ", datetime: " yyyy/mmm/dd hh:mm " }, { title: "My notes 5", datetime: "yyyy/mmm/dd hh:mm" }]; $scope. Publicnotelist = [{ title: "Note 1", sharename: "share by who", datetime: "yyyy/mmm/dd hh:mm" }, { title: "NOTE 2", sharename: "Share by who", datetime: "yyyy/mmm/dd hh:mm" }, { title: "NOTE 3", sharename: "share by who", datetime: "YYYY/ mmm/dd hh:mm " }, { title: "Note 4", &NBSP;&NBSP;&NBSP;&Nbsp; sharename: "Share by who", datetime: "yyyy/mmm/dd hh:mm" }, { title: "My notes 1", sharename: "share by who", datetime: "YYYY/ mmm/dd hh:mm " }]; $scope. Notetabs = [{ name: ' privatenote ', text: "My Notes", active: true }, { name: ' publicnote ', text: ' Public note ", &NBSP;&NBSP;&NBSP;&NBSP;&NBsp; active: false }]; $scope. triggersubtabs = function (tabname) { var i = $ scope.notetabs.length; while (i--) $scope. NoteTabs[i] .active = $scope. notetabs[i][' name '] == tabname ? true : false; angular.element ($window). bind (' Orientationchange ', function () { $scope. $apply (); }); }; // $ Scope.private_note = function () { // $ State.go (' Course. Classnote.privatenOte '); // }; // $scope. public_ Note = function () { // $state. Go (' Course. Classnote.publicnote '); // }; $ scope.flag = {showdelete:false}; $scope. PrivateNoteEditAndCancel = "edit"; $scope .privatenoteeditstate = false; //Edit button $scope. Privatenote_edit = function () { //$scope .privatenoteeditstate = $scope .privatenoteeditstate == true ? false : true; $scope. Flag.showDelete =! $scope. Flag.showdelete; $scope. privatenoteeditstate = !$ scope.privatenoteeditstate if ($scope. privateNoteEditState == true) { $ scope.privatenoteeditandcancel = "Cancel"; } else { $scope. privatenoteeditandcancel = "Edit"; } }; //Select Cancel $scope. Notechecked = function (privatenote) { privateNote.checked = !privateNote.checked; //alert (privatenote.checked); }; $ scope.allselectornot = "Select All"; //$scope .allselectmode = false; //Full Selection $scope. selectall = function () { for (var i =0 ; i<$ scope.privatenotelist.length;i++) { $ scope.privatenotelist[i].checked =true; // Alert ( $scope. privatenotelist[i].checked); } } //Delete $scope. Deleteall =function () { for (var i =0 ; i< $scope. privatenotelist.length;i++) { if ($ Scope.privatenotelist[i].checked ===true) { //alert ($scope. privatenotelist[i].checked + $scope. Privatenotelist[i].title); $ Scope.privateNoteList.splice (i,1); i--; } } //return $ Scope.privateNoteList.splice (i,1); } } ])
Comments:
Angular Select Delete Small function