Angular2:导入Bootstrap插件

时间:2016-10-31 11:46:59

标签: css twitter-bootstrap angular plugins twitter-bootstrap-3

我遇到了Angular2,Bootstrap 3.3.7和Bootstrap插件的问题。 在'index.html'中,我导入了所有样式表和JavaScript文件。

这是index.html

<!-- Bootstrap & JQuery -->
<script src="js/jquery-3.1.1.min.js"></script>
<script src="js/tether.min.js"></script>
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/bootstrap.min.js"></script>

<!-- Bootstrap Toggle Switch -->
<link rel="stylesheet" href="css/bootstrap-toggle.min.css">
<script src="js/bootstrap-toggle.min.js"></script>

<!-- Bootstrap Table -->
 <link rel="stylesheet" href="css/bootstrap-table.min.css">
<script src="js/bootstrap-table.min.js"></script>
<script src="js/bootstrap-table-zh-CN.min.js"></script>

<!-- eigener Stylesheet -->
<link rel="stylesheet" href="css/custom.css">

<script>
      System.import('app').catch(function(err){ console.error(err); });
</script>
<base href="/">
</head>
<!-- 4. Display the application -->
<body>
    <DVBViewerApp>Loading...</DVBViewerApp>
</body>
</html>

文件服务器都可以找到这些文件,但我有一个问题: Bootstrap 3.3.7本身正在整个应用程序上运行而没有任何问题。 但是这两个插件(bootstrap-toggle和bootstrap-table)都不适用于我的任何组件。他们只是在index.html工作。

有谁知道这个问题是什么?

非常感谢!

1 个答案:

答案 0 :(得分:0)

首先运行npm install bootstrap@3.3.7。

然后检查您的项目结构是否与我的相同。

项目
| ____ e2e
| ____ node_modules
| ____ src
| ____ .gitignore
| ____ angular.json
| ____ package.json
| ____ package-lock.json
| ____ tsconfing.json
| ____ tslint.json

如果相同,请添加this