Search code examples
angularoffice-ui-fabric

Importing fabric js components in angular 4 project


I have tried to install fabric-js components in my angular 4 project

using the commands

    npm install ng office-ui-fabric --save

provided in the link

    https://github.com/ngOfficeUIFabric/ng-officeuifabric#installation

I have followed all steps correctly,but i am still unable to find

     1)/node_modules/office-ui-fabric/fabric.css
     2)/node_modules/office-ui-fabric/fabric.components.css

in my node_modules folder.I am bit confused that how to to use fabric component in

    app.component.ts folder

Solution

  • The first step will be to open to the .angular-cli.json file and add your third party css files

    "styles": [
      "./node_modules/office-ui-fabric/dist/css/fabric.css",
      "./node_modules/office-ui-fabric/dist/css/fabric.components.css"
      "styles.css"
    ]
    

    If you want to add Js file then you have to add script inside your scripts array

    "scripts": [
          "./node_modules/.../../../../.js"
        ]