I need to view a checkbox when the mouse is over an <li> tag. So initially, the menu li has simply a label (all inside an ng-repeat). When i pass over one of them it change in checkbox. Of course when the mouse leave it it comes back to label. I tried but it's not working and it views always both (checkbox and label) This is the code with a jsfiddle :
http://jsfiddle.net/HB7LU/20368/
var myApp = angular.module('myApp',[]);
function MyCtrl($scope) {
$scope.all_titles = [
"Title 1",
"Title 2",
"Title 3",
"Title 4"
];
$scope.checkBoxSelection = false;
$scope.OnMouseOverCheckbox = function(value) {
$scope.checkBoxSelection = value;
}
}
<div ng-controller="MyCtrl">
<ul>
<li id="$index" ng-repeat="title in all_titles" ng-mouseover="OnMouseOverCheckbox(true)" ng-mouseleave="OnMouseOverCheckbox(false)">
<input type="checkbox" data-ng-if="checkBoxSelection == true" ng-model="data.cb1" aria-label="Checkbox 1"/>
<a data-ng-if="checkBoxSelection == false">{{title}}</a>
</li>
</ul>
</div>
Everything is used with AngularJs and ng-mouseover / ng-mouseleave directives