我正在开展一个角色4项目。我将我的js文件链接到我的应用程序组件呈现的索引文件中。
<!DOCTYPE html>
<html>
<head>
<title>Angular QuickStart</title>
<base href="/">
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Fonts -->
<link rel="stylesheet" href="css/montserrat.css">
<!-- CSS -->
<!-- Bootstrap CSS
============================================ -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Icon Font CSS
============================================ -->
<link rel="stylesheet" href="css/eleganticons.min.css">
<!-- Plugins CSS
============================================ -->
<link rel="stylesheet" href="css/plugins.css">
<!-- Style CSS
============================================ -->
<link rel="stylesheet" href="style.css">
<!-- Polyfill(s) for older browsers -->
<script src="node_modules/core-js/client/shim.min.js"></script>
<script src="node_modules/zone.js/dist/zone.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="systemjs.config.js"></script>
<script>
System.import('main.js').catch(function(err){ console.error(err); });
</script>
</head>
<body>
<my-app>
<!--Preloader-->
<div id="loading" class="preloader">
<div class="loading-center">
<div class="loading-center-absolute">
<div class="object object_one"></div>
<div class="object object_two"></div>
<div class="object object_three"></div>
<div class="object object_four"></div>
</div>
</div>
</div>
</my-app>
</body>
<!-- JS -->
<!-- jQuery JS
============================================ -->
<script src="js/vendor/jquery-1.12.0.min.js"></script>
<!-- Bootstrap JS
============================================ -->
<script src="js/bootstrap.min.js"></script>
<!-- Plugins JS
============================================ -->
<script src="js/plugins.js"></script>
<!-- Main JS
============================================ -->
<script src="js/main.js"></script>
</html>
当我加载此页面时,正在执行这些文件中的javascript,但是当我将组件HTML代码放入索引文件中时,js会被执行并且一切正常。我需要做些什么来使我的js工作。这是我的第一个有角度的项目,所以我仍在尝试学习框架的进出。