我的目录结构如下:
dir
|--app.component.ts
node_modules
|--angular2-bootstrap-switch我遵循https://www.npmjs.com/package/angular2-bootstrap-switch添加angular2引导开关,按照指示,我不得不这样做,但是,我不知道怎么做。
index.html:
<script src="node_modules/es6-shim/es6-shim.min.js"></script>
<script src="node_modules/systemjs/dist/system-polyfills.js"></script>
<script src="node_modules/angular2/bundles/angular2-polyfills.js"></script>
<script src="node_modules/systemjs/dist/system.src.js"></script>
<script src="node_modules/rxjs/bundles/Rx.js"></script>
<script src="node_modules/angular2/bundles/angular2.dev.js"></script>
<!-- 2. Configure SystemJS -->
<script>
System.config({
packages: {
app: {
format: 'register',
defaultExtension: 'js'
}
}
});
System.import('app/boot')
.then(null, console.error.bind(console));
</script>
</head>
<!-- 3. Display the application -->
<body>
<my-app>Loading...</my-app>
</body>内部boot.ts
import {bootstrap} from 'angular2/platform/browser'
import {AppComponent} from './app.component'
bootstrap(AppComponent);在tsconfig.json中
"exclude": [
"node_modules",
"typings/main",
"typings/main.d.ts"
]现在我必须在../node_modules/angular2_bootstrap_switch/components中导入app.component.ts,比如:
import {SwitchComponent} from angular2_bootstrap_switch/components我不确定是怎么回事。请帮帮忙。
发布于 2017-07-01 16:18:20
使用这个非常简单。
https://stackoverflow.com/questions/44862818
复制相似问题