Bootstrap Glyphicons not displaying in angular2

前端 未结 11 1792
天涯浪人
天涯浪人 2020-12-24 14:20

I am trying to use bootstrap glyphicons in my angular2 app. I have installed bootstrap using the command npm install bootstrap --save My code snippet is



        
11条回答
  •  抹茶落季
    2020-12-24 14:30

    Boostrap 4 does not support Glyphicons anymore, you can use Font Awesome instead:

    npm install --save fortawesome/fontawesome-free
    

    OR install the official Angular Fontawesome Package: https://github.com/FortAwesome/angular-fontawesome

    and add the css File to your .angular-cli.json

    "apps": [
              {
                 ....
                 "styles": [
                    "styles.css",
                    "../node_modules/bootstrap/dist/css/bootstrap.css",
                    "../node_modules/font-awesome/css/font-awesome.css"
                 ],
                 ...
             }
           ]
    
    ],
    

    Replace CSS class with the Font Awesome classes:

     
    

    recompile app: ng serve

提交回复
热议问题