ng2-bootstrap-development不能为我编译。我在那里看到了You have to be inside an angular-cli project in order to use the serve command. -cli,但是当我运行ng serve时,我得到了angular-cli,我错过了什么?
发布于 2017-02-09 05:28:07
我发现,如果你想把它和angular-cli一起使用,你必须执行以下步骤:
npm i -g angular-cli
ng new my-app
cd my-app
ng serve添加ng2-bootstrap
现在安装ng2-bootstrap和bootstrap
npm install ng2-bootstrap bootstrap --save打开src/app/app.module.ts并添加
import { AlertModule } from 'ng2-bootstrap';
...
@NgModule({
...
imports: [AlertModule.forRoot(), ... ],
...
})现在打开angular-cli.json并在样式数组中插入一个新条目
"styles": [
"styles.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css"
],现在打开src/app/app.component.html并添加
<alert type="success">hello</alert>源:
https://github.com/valor-software/ng2-bootstrap/blob/development/docs/getting-started/ng-cli.md
发布于 2017-02-09 06:24:20
下面是如何使用virtualenv运行和服务ng2-bootstrap演示。由我值得信赖的同事提供。
cd ~
mkdir test
cd test
virtualenv venv
source venv/bin/activate
pip install nodeenv
nodeenv -p
git clone https://github.com/valor-software/ng2-bootstrap.git
cd ng2-bootstrap
npm install -g angular-cli
npm install
npm run demo.servehttps://stackoverflow.com/questions/42123711
复制相似问题