mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-07 06:57:02 +08:00
Mark tasks as completed
This commit is contained in:
@ -24,6 +24,9 @@
|
|||||||
<script src="../../js/controllers/ionic-leftrightmenu.js"></script>
|
<script src="../../js/controllers/ionic-leftrightmenu.js"></script>
|
||||||
|
|
||||||
<script src="js/toderp.js"></script>
|
<script src="js/toderp.js"></script>
|
||||||
|
<style>
|
||||||
|
.content { height: 100%; }
|
||||||
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body ng-controller="ToderpCtrl">
|
<body ng-controller="ToderpCtrl">
|
||||||
<div ng-switch on="display.screen" class="reveal-animation">
|
<div ng-switch on="display.screen" class="reveal-animation">
|
||||||
@ -94,6 +97,7 @@
|
|||||||
<ul class="list">
|
<ul class="list">
|
||||||
<li class="list-item" ng-repeat="task in tasks">
|
<li class="list-item" ng-repeat="task in tasks">
|
||||||
{{task.text}}
|
{{task.text}}
|
||||||
|
<input type="checkbox" ng-model="task.completed">
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -86,9 +86,9 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
|
|||||||
};
|
};
|
||||||
})
|
})
|
||||||
|
|
||||||
.controller('TasksCtrl', function($scope, angularFireCollection, FIREBASE_URL) {
|
.controller('TasksCtrl', function($scope, angularFire, FIREBASE_URL) {
|
||||||
var taskRef = new Firebase(FIREBASE_URL + '/tasks');
|
var taskRef = new Firebase(FIREBASE_URL + '/tasks');
|
||||||
$scope.tasks = angularFireCollection(taskRef);
|
$scope.tasks = angularFire(taskRef, $scope, 'tasks');
|
||||||
$scope.addTask = function(task) {
|
$scope.addTask = function(task) {
|
||||||
var t = {};
|
var t = {};
|
||||||
t = angular.extend({
|
t = angular.extend({
|
||||||
@ -96,7 +96,7 @@ angular.module('toderp', ['firebase', 'ngRoute', 'ngAnimate'])
|
|||||||
}, task);
|
}, task);
|
||||||
|
|
||||||
console.log("Adding task:", t);
|
console.log("Adding task:", t);
|
||||||
$scope.tasks.add(t);
|
$scope.tasks.push(t);
|
||||||
|
|
||||||
$scope.task = {};
|
$scope.task = {};
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user