I am currently learning AngularJS and already started a little project, which is basically an older project of mine, done in jQuery.
Everythings fine so far, but the last hours I wrapped my head around this area. In jQuery back then 5 minutes, but I have no idea what's the best way in AngularJS)
Here is my jQuery: A calendar view. It opens and closes days on click. Once a day is clicked it gets the class opened. Also there is the state locked, where I disable to open the day at all.
$('.mod-item').on('click', function(){
if ($(this).find('.mod-item-day').not('.locked')) {
if($(this).find('.mod-item-day').hasClass('open')){
$(this).find('.mod-item-day').removeClass('open').addClass('opened');
}else{
$(this).find('.mod-item-day').addClass('open');
}
}
});
Here is the markup:
<ul class="mod">
<li class="mod-item">
<div class="mod-item-day opened"><span>1</span></div>
<div class="mod-item-content">
<img src="../images/present1_late.jpeg" alt="">
</div>
</li>
So my question is - what's the most AngularJS way to do it?