如果您使用 angular-cli,您可以将所有外部 JS 文件添加到 assets 文件夹中。然后在angular-cli.json 中添加它们:
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/moment/moment.js",
"../node_modules/chart.js/dist/Chart.bundle.min.js",
"../node_modules/chart.js/dist/Chart.min.js",
"../node_modules/ng2-datetime/src/vendor/bootstrap-datepicker/bootstrap-datepicker.min.js",
"./assets/js/slimscroll.min.js",
"./assets/js/inspinia.js",
"./assets/js/metisMenu.js",
"./assets/js/footable.all.min.js"
]
你也可以使用外部样式:
"styles": [
"../node_modules/ng2-toastr/bundles/ng2-toastr.min.css",
"../node_modules/bootstrap-sass/assets/stylesheets/_bootstrap.scss",
"../node_modules/font-awesome/scss/font-awesome.scss",
"../node_modules/ng2-datetime/src/vendor/bootstrap-datepicker/bootstrap-datepicker3.min.css",
"./assets/scss/plugins/footable/footable.core.css",
"./assets/scss/style.scss"
]
当然你是对的,那么你需要添加typings.d.ts:
declare var PrayTimes:any;
declare var System: any;
declare var $: any;
declare var moment: any;
declare var Chart: any;