0
我現在正在處理角度4項目。我有我的js文件鏈接到我的應用程序組件被呈現給索引文件。Angular 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
\t ============================================ -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Icon Font CSS
\t ============================================ -->
<link rel="stylesheet" href="css/eleganticons.min.css">
<!-- Plugins CSS
\t ============================================ -->
<link rel="stylesheet" href="css/plugins.css">
<!-- Style CSS
\t ============================================ -->
<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工作。這是我的第一個角色項目,所以我仍然試圖學習框架的內部和外部。
你爲什麼不使用角度cli? – Kuncevic
與上面相同的問題...並使用'angular-cli',因爲它是很棒的工具))) –
從來沒有聽說過角度cli – John