lundi 23 février 2015

Angularfire remove items by checkbox

I am using Angularfire and I'd like to remove the items by checkbox.


And there is a button that can do the "checkAll" and another do the "uncheckAll"


HTML



<div ng-app="app" ng-controller="Ctrl">
<li ng-repeat="item in newslist">
<input type="checkbox"> {{item.newsTitle}}
</li>
<br>
<button ng-click="checkAll()">check all</button>
<button ng-click="uncheckAll()">uncheck all</button>
<button ng-click="newslist.$remove(item)">Remove</button>
</div>


JS



var app = angular.module("app", ["firebase"]);
app.value('newsURL', 'http://ift.tt/1FmR5vt');
app.factory('newsFactory', function($firebase, newsURL) {
return $firebase(new Firebase(newsURL)).$asArray();
});
app.controller('Ctrl', function($scope, $firebase, newsFactory) {
$scope.newslist = newsFactory;
$scope.checkAll = function() {

};
$scope.uncheckAll = function() {

};
});


plunker here


I don't know how to remove the items by checkbox or how to make the "checkAll" button work.


I will be appreciate if someone could tell me your answer.





Aucun commentaire:

Enregistrer un commentaire