How can I use JavaScript code in Angular 7?
问题 I'm trying to make a collapsible navbar with the help of MaterializeCSS when used on mobile screen and need to use JavaScript code in it. Where should I write this JavaScript code? This is the code I want to use: **$(document).ready(function(){ $('.sidenav').sidenav(); });** 回答1: Step-1: Created a js folder inside the assets folder. Step-2: Created a new .js file inside the js folder. Assets -> js -> example.js Step-3: Added path of the example.js in angular.json inside the scripts array.