I have an array of students which I present their names in a list and under each name two buttons that allow assigning them a positive or negative rating.
What I want to do is to click on the button (positive or negative) to show a message and hide the div buttons
then I share what I have:
html view
<ul class="ejemplo" ng-app ng-controller="sample">
<div ng-repeat="i in estudiantes">
<h5>{{i.nombres}}</h5>
<div class="botones">
<input type="button" data-ng-click=calificar($event,i.id) value="calificacion positiva" id="1"/>
<input type="button" data-ng-click=calificar($event,i.id) value="calificacion negativa" id="2"/>
</div>
</div>
</ul>
controller.js
function sample ($scope) {
$scope.estudiantes = [
{
nombres: 'Diego Israel',
id: 2
},
{
nombres: 'Juan Carlos',
id: 3
},
{
nombres: 'Pedro',
id: 4
}
];
$scope.calificar = function(event,id){
var estado = event.target.id;
switch (estado) {
case '1':
//para no mostrar este alert quiero ocultar el div botones y mostrar el respectivo mensaje
alert('calificacion positiva');
break;
case '2':
//para no mostrar este alert quiero ocultar el div botones y mostrar el respectivo mensaje
alert('calificacion negativa');
break;
default:
return false;
}
}
}
The idea is that once the button has been clicked, the message will automatically appear under the name of the student selected. I hope you made me understand. Thank you in advance