I am looking for some help with a little Angular App.
I have a group of items/images that when a plus icon is clicked, all other items are covered and the selected item is not covered.
I want to now trigger this from outside of the ng-repeat.
I am looking for a way to trigger the cover effect when clicking on a text link, as well as the plus icon now used.
Have it use both options.
So far I have the text triggers fire off a id, that can be used in the app code.
Here is a Working FIDDLE.
Here is the original question that Avijit Gupta did for this.
Avijit's post is the excepted answer.
Any help with this is greatly appreciated.
The nav Text trigger code...
<div class="col-xs-12 navText">
<ul>
<li><a href data-id='1' data-ng-click="idLocation($event)">ONE</a></li>
<li><a href data-id='2' data-ng-click="idLocation($event)">TWO</a></li>
<li><a href data-id='3' data-ng-click="idLocation($event)">THREE</a></li>
<li><a href data-id='4' data-ng-click="idLocation($event)">FOUR</a></li>
<li><a href data-id='5' data-ng-click="idLocation($event)">FIVE</a></li>
</ul>
</div>
The app code...
// nav text trigger id's
$scope.idLocation = function (e) {
ids = $(e.target).data('id');
console.log(ids);
};
$scope.setToInitialState = function() {
$scope.blocks.forEach(function(block) {
$scope.isSelected[block.id] = false;
$scope.isCovered[block.id] = false;
});
};
$scope.selectBlock = function(id) {
$scope.isSelected[id] = !$scope.isSelected[id];
$scope.isCovered[id] = false;
if ($scope.isSelected[id]) {
$scope.blocks.forEach(function(block) {
if (block.id !== id) {
$scope.isCovered[block.id] = true;
$scope.isSelected[block.id] = false;
}
});
}
else {
$scope.setToInitialState();
}
};
});