I have an Angular js view.html page where I am passing a string called datadict from the $scope method of the controller.
Value {{ datadict.days }} is displaying value Nearly everyday and {{ datadict.days.includes('Nearly everyday') }} is showing result true.
Here is my code :
<div class="some_class">
<ul class="ex1">
<li><a ng-click ="datadict.days.includes('Not applicable')" class="mdcl-tab1">Not applicable</a> </li>
<li><a ng-click ="datadict.days.includes('Several Days')" class="mdcl-tab1">Several Days</a> </li>
<li><a ng-click ="datadict.days.includes('More than half the days')" class="mdcl-tab1">More than half the days</a> </li>
<li><a ng-click ="datadict.days.includes('Nearly everyday')" class="mdcl-tab1">Nearly everyday</a> </li>
</ul>
</div>
And when an element gets clicked, the event is handled by this function :
<script>
$(document).ready(function () {
$(".mdcl-tab1").on('click',function(){
$(this).addClass('tick');
$('.ex1').attr('id', 'ex1');
});
});
</script>
The problem is I want to trigger the click event on that <a>
element for which the above condition is true that's why I added this condition ng-click ="datadict.days.includes('Nearly everyday')" but I am not getting the desired result. What am I doing wrong ?