How to write Java Script function in angular 4? : I am newbie to Angular 4. Following function is the one we currently using in asp.net project. Its working perfectly. This function is for change the arrow icon of font awesome.

         <script type="text/javascript">        
         $('.collapse').on('shown.bs.collapse', function () {
         $(this).parent().find(".fa-caret-down").removeClass("fa-caret-down").addClass("fa-caret-up");
    }).on('hidden.bs.collapse', function () {
         $(this).parent().find(".fa-caret-up").removeClass("fa-caret-up").addClass("fa-caret-down");
           });
        </script> 

**How to write the above function in angular 4?**