I wrote some code for toggling the dropdown menu with jquery. So i am trying to write code in angularJs. I don't know that much about angularjs.
Html template
<div id="add" class="modal category modal-fixed-footer">
<div class="modal-content">
<h4>Categories</h4>
<div class="wrapper">
<ul class="collection main first-level">
<!-- FIRST LEVEL ITEM (WOMEN) -->
<li class="collection-item">
<span class="item-wrapper">
<span>Women<i class="material-icons">arrow_drop_down</i></span>
</span>
<p class="checkbox">
<input type="checkbox" class="filled-in" id="1"/>
<label for="1"></label>
</p>
<ul class="collection second-level">
<!-- SECOND LEVEL ITEM -->
<li class="collection-item ">
<span class="item-wrapper">
<span>Women's Clothing<i class="material-icons">arrow_drop_down</i></span>
</span>
<p class="checkbox">
<input type="checkbox" class="filled-in" id="2" />
<label for="2"></label>
</p>
<ul class="collection third-level">
<!-- SECOND LEVEL ITEM -->
<li class="collection-item"><span class="item-wrapper">Blazers </span><p class="checkbox"><input type="checkbox" class="filled-in" id="3" /><label for="3"></label></p></li>
<li class="collection-item"><span class="item-wrapper">Jeans </span><p class="checkbox"><input type="checkbox" class="filled-in" id="6" /><label for="6"></label></p></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div class="modal-footer">
<a href="#!" class="modal-action modal-close waves-effect btn-flat ">Save</a>
<a href="#!" class="modal-action modal-close waves-effect btn-flat ">Cancel</a>
</div>
</div>
Jquery code
$( ".collection-item > span" ).click(function() {
$(this).next(".collection").slideToggle( "medium" );
$(this).next().next(".collection").slideToggle( "medium" );
var icon = $(this).find('i').text();
if (icon == "arrow_drop_up") {
$(this).find('i').text("arrow_drop_down");
} else {
$(this).find('i').text("arrow_drop_up");
}
});
How can we write same functionality code in angularJs instead of Jquery. Please do the needful.