This is a method in my Angular 2 component. I use TypeScript to write my Angular 2 modules. As the code shown below - I am using Jquery to access the dom level. Is it a good practice to do in Angular 2 ? Can anyone please describe the trade offs of using jquery inside Angular 2. What is the alternate way to achieve this code snippet. Code example will be appreciable , as I am a noob Angular 2 developer :)
declare var $:any;
showhidePreviousButton() {
if($('#analysisTabs').find('ul.nav-tabs > .active').prev('li').length < 1) {
$('.prev-btn').hide();
}
else {
$('.prev-btn').show();
}
}
I am doing dynamic tab creation in my angular 2 project . Here my code is hiding "previous button" if there is only one tab, and it shows if there is more than one tab.