Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/28.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Twitter bootstrap 3 在angular 2组件中未应用引导类_Twitter Bootstrap 3_Angular - Fatal编程技术网

Twitter bootstrap 3 在angular 2组件中未应用引导类

Twitter bootstrap 3 在angular 2组件中未应用引导类,twitter-bootstrap-3,angular,Twitter Bootstrap 3,Angular,这是我的第一个angular 2应用程序,不知道为什么没有应用引导类或者缺少图标?有人能解释一下如何在angular 2中使用引导类吗 这是我的app.component.ts 从'angular2/core'导入{Component}; 从“./like.component”导入{LikeComponent} @组成部分({ 选择器:“我的应用程序”, 模板:` `, 指令:[LikeComponent] }) 导出类AppComponent{ 推特={ 总计:10, 我喜欢:错 } }实际

这是我的第一个angular 2应用程序,不知道为什么没有应用引导类或者缺少图标?有人能解释一下如何在angular 2中使用引导类吗

这是我的app.component.ts

从'angular2/core'导入{Component};
从“./like.component”导入{LikeComponent}
@组成部分({
选择器:“我的应用程序”,
模板:`
`,
指令:[LikeComponent]
})
导出类AppComponent{
推特={
总计:10,
我喜欢:错
}

}
实际上,问题是您没有在主文件(即index.html文件)中导入Bootstrap.css文件, 尝试在index.html中使用此核心引导文件,您的代码将运行

在index.html中导入此文件:-

<link data-require="bootstrap-css@3.3.6" data-semver="3.3.6" rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.css" />


这里是你的代码的exmaple

注意,他们在bootstrap 4.0中删除了图标集成;因此,虽然公认的答案可能成立,但如果您使用的是Bootstrap4.0,它将不会有任何帮助,而现在是Angular 2的最新版本