0
我試圖在組件模板中添加jquery onclick事件,例如, app.component.html在angualr2組件模板中添加jquery
<li>
<a id="menu-close" href="#services">Services</a>
</li>
和我在一個custom.js寫了一個函數文件如
$("#menu-close").click(function(e) {
....
}
但我不知道如何加載custom.js,只是添加
<script src="js/custom.js"></script>
index.html中?
當你使用'angular'你不需要'jquery'。嘗試在'html'中實現像ng-click這樣的角度選項。也加載'custom.js'爲你的'js'文件 –