I found THIS solution, it works fine on static pages but for some reason doesn't work on angular.
Demo: http://jsfiddle.net/6q5xnmL9
My html code:
<div class="container-fluid" style="background-color: #f3f7fa">
<nav class="navbar navbar-expand-lg navbar-light d-flex" >
<a data-toggle="#action" class="nav-item">QUICK ACTION</a>
<a data-toggle="#basic" class="nav-item">BASIC</a>
<a data-toggle="#notes" class="nav-item">NOTES</a>
<a data-toggle="#deals" class="nav-item">DEALS</a>
<a data-toggle="#reminder" class="col-auto nav-item">REMINDER</a>
</nav>
</div>
//div's to be toggled
<div id="action" class="actions mod-row">...</div>
<div id="basic" class="actions mod-row">...</div>
<div id="notes" class="actions mod-row">...</div>
<div id="deals" class="actions mod-row">...</div>
<div id="reminder" class="actions mod-row">...</div>
CSS:
div.actions:not(#action) {
display: none;
}
solution given in above link:
$("a[data-toggle]").on("click", function(e) {
e.preventDefault(); // prevent navigating
var selector = $(this).data("toggle"); // get corresponding element
$(".actions").hide();
$(selector).show();
}
);
However, using this code angular was showing error :
parameter 'e' implicitly has an 'any' type
so I modified the code to:
$("a[data-toggle]").on("click", function(e:Event) {
e.preventDefault(); // prevent navigating
var selector = $(this).data("toggle"); // get corresponding element
$(".actions").hide();
$(selector).show();
}
);
also tried:
$("a[data-toggle]").on("click", function() {
this.preventDefault(); // prevent navigating
var selector = $(this).data("toggle"); // get corresponding element
$(".actions").hide();
$(selector).show();
}
);
And lastly I even removed the prevention navigation line of code. I am not sure if these were correct but all of these modifications removed the error but the toggle still didn't work. What am I missing?