2016-12-14 38 views
1

我正在將AngularJS應用程序轉換爲Angular 2 application.Bootstrap功能在Angular 2中不適用,AngularJS中使用了AngularJS。是否有任何其他的Angular 2引導選項?angular1 bootstrap在angular2中不支持

<li class="dropdown"><a class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">OrangeTestDefaultActivity<span class="caret"></span></a> 
    <ul class="dropdown-menu"> 
    <li><a ng-click="handle_url('Screen_1050')">Label</a></li> 
    <li><a ng-click="handle_url('Screen_1100')">Become</a></li> 
    </ul> 
    </li> 
+0

https://ng-bootstrap.github.io –

+0

正常的引導是不是在[如何角2項目中使用CSS自舉圖書館angular2 –

+1

可能重複的工作? ](http://stackoverflow.com/questions/36292438/how-to-use-bootstrap-css-library-in-angular-2-project) –

回答

0

索引中的HTML文件,導入

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"> 
2

與Angular2的整合也可以通過NG2的自舉項目: https://github.com/valor-software/ng2-bootstrap

要安裝它,只需將這些文件放在你的主HTML頁面:

<script src="https://cdnjs.cloudflare.com/ajax/libs/ng2-bootstrap/x.x.x/ng2-bootstrap.min.js"></script> 
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> 

然後你可以用它到你的組件是這樣的:

import {Component} from 'angular2/core'; 
import {Alert} from 'ng2-bootstrap/ng2-bootstrap'; 
@Component({ 
    selector: 'my-app', 
    directives: [Alert], 
    template: `<alert type="info">ng2-bootstrap hello world!</alert>` 
}) 
export class AppComponent { 
}