1

I am trying to add material lite stepper to my angular2 project.

I did npm install mdl-stepper --save and then in my index file added:

<!-- material lite -->
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<link rel="stylesheet" href="https://code.getmdl.io/1.3.0/material.indigo-pink.min.css">
<script defer src="https://code.getmdl.io/1.3.0/material.min.js"></script>
<!-- MDL stepper -->
<link rel="stylesheet" href="../../node_modules/mdl-stepper/stepper.min.css">
<script defer src="../../node_modules/mdl-stepper.min.js"></script>

However in my browser console it gives me 404 error. I tried with ../node_modules and /node_modules or even ../../node_modules but it did not help. Folder structure looks like following:

enter image description here

What am I doing wrong?

4

1 回答 1

1

在这里回答Angular Cli Webpack,如何添加或捆绑外部 js 文件?很有用。

不需要在 index.html 中添加 css 和 js。

css 进入 styles.css 和 js 进入 angular-cli.json -> inside"scripts":[]

于 2017-02-16T23:25:38.193 回答