0
我正在編寫一個應用程序在angular2中,我不知道應該在組件級別包括引導程序引用或我們應該在index.html中使用一次。 每種風格的優點和缺點是什麼。謝謝 !!在哪裏引用引導角2
我正在編寫一個應用程序在angular2中,我不知道應該在組件級別包括引導程序引用或我們應該在index.html中使用一次。 每種風格的優點和缺點是什麼。謝謝 !!在哪裏引用引導角2
你需要在你的index.html文件中包含boostrap css。
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
如果你想使用ng2-bootstrap
你可以用它爲您的組件是這樣的:
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 {
}
當你做到這一點在你需要的所有元素的必要方式,第一種方式,第二種方式有可用於angular2的組件。