0
Hello, could someone explain to me how to do when I check the checkbox of the activity "Incomplete" it be sent to the activity list "Complete"?
angular.module('TarefApp', []);
// Code goes here
angular.module('TarefApp')
.controller('TarefasController', function($scope) {
$scope.tarefas = [];
$scope.addTarefa = function(tarefa) {
tarefa.selecionado = false;
$scope.tarefas.push(angular.copy(tarefa));
delete $scope.tarefa;
};
$scope.delTarefas = function() {
var oldTarefas = $scope.tarefas;
$scope.tarefas = [];
angular.forEach(oldTarefas, function(tar) {
if (!tar.selecionado) $scope.tarefas.push(tar);
});
};
});
<!DOCTYPE html>
<html lang="pt-br" ng-app="TarefApp">
<head>
<meta charset="utf-8" />
<title>Teste de Performance 4</title>
<!-- Bootstrap -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
<!-- Angular.js minificado -->
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script>
<!-- Angular.js minificado -->
<script src="app.js"></script>
<script src="teste.js"></script>
<!-- CSS -->
<style type="text/css">
.done-true {
text-decoration: line-through;
}
</style>
</head>
<body>
<div id="div-container" class="container" ng-controller="TarefasController">
<div class="page-header">
<h4>Adicionar Tarefa</h4>
</div>
<div id="div-form">
<form role="form">
<div class="form-group">
<input type="text" class="form-control" ng-model="tarefa.nome">
</div>
<button class="btn btn-info btn-block" ng-click="addTarefa(tarefa)" ng-model="infoIgual" ng-disabled="!tarefa.nome">Adicionar</button>
</form>
</div>
<div class="page-header">
<h4>Tarefas Incompletas</h4>
</div>
<div ng-repeat="tarefa in tarefas">
<input type="checkbox" ng-model="tarefa.selecionado">
<span class="done-{{tarefa.selecionado}}">{{tarefa.nome}}</span>
</div>
<div class="page-header">
<h4>Tarefas Completas</h4>
</div>
<div>
</div>
</br>
<button class="btn btn-danger" ng-click="delTarefas()">Apagar selecionados</button>
</div>
</body>
</html>
In fact, I was just about to do there in that same answer
– MarceloBoni
I thought it best to create a new topic, in case any user has the same difficulty will have an easier access to solving the problem.
– Larissa Mourullo