App.html
<! DOCTYPE html>
App.js
Angular.module (' Ionicapp ', [' Ionic ']). Controller (' Rootctrl ', function ($scope) {$scope. oncontrollerchanged = Fun Ction (Oldcontroller, Oldindex, Newcontroller, NewIndex) {console.log (' Controller changed ', Oldcontroller, Oldind
Ex, Newcontroller, NewIndex);
Console.log (arguments);
};
}. Controller (' Homectrl ', function ($scope, $timeout, $ionicModal, $ionicActionSheet) {$scope. items = [];
$ionicModal. Fromtemplateurl (' newtask.html ', function (modal) {$scope. Settingsmodal = modal;
}); var RemoveItem = function (item, button) {$ionicActionSheet. Show ({buttons: [], Destructivetext: ' Delete T
Ask ', Canceltext: ' Cancel ', cancel:function () {return true;
}, Destructivebuttonclicked:function () {$scope. Items.splice ($scope. Items.indexof (item), 1);
return true;
}
});
};
var Completeitem = function (item, button) {item.iscompleted = true;
}; $scope. Onreorder = FunctioN (el, start, end) {ionic.
Utils.arraymove ($scope. Items, start, end);
};
$scope. Onrefresh = function () {Console.log (' on REFRESH ');
$timeout (function () {$scope. $broadcast (' Scroll.refreshcomplete ');
}, 1000);
$scope. RemoveItem = function (item) {RemoveItem (item);
};
$scope. NewTask = function () {$scope. Settingsmodal.show ();
}; Create the items for (var i = 0; i < i++) {$scope. Items.push ({title: ' Task ' + (i + 1), Butt ONS: [{text: ' Done ', type: ' Button-success ', Onbuttonclicked:completeitem,}, {text:
' Delete ', type: ' Button-danger ', Onbuttonclicked:removeitem,}]};
}). controller (' Taskctrl ', function ($scope) {$scope. close = function () {$scope. Modal.hide (); }
});
Effect:
Reference Link: Http://www.haomou.net/2014/08/11/2014_ionic_api
Some related JS download address: http://code.ionicframework.com