我是新角度4;我已經安裝使用npm install -g @angular/cli
。然後使用ng new my-app
創建了一個新項目。本地文件在angularjs中顯示404錯誤4
|-src
| -app
| app.component.css
| app.component.html
| app.component.spec.ts
| app.component.ts
| app.module.ts
src
文件夾包含app文件夾,其中包含相應的上述css,ts,html文件。現在,我已經在app文件夾
|-src
| -app
| app.component.css
| app.component.html
| app.component.spec.ts
| app.component.ts
| app.module.ts
| image.jpg
的問題是增加了一個圖像,當我在app.component.html添加<img src="image.jpg">
標籤,它顯示在控制檯中404
錯誤。但是如果我在app.component.css中添加一個類似background: url('image.jpg');
的樣式,它就可以工作。
有什麼建議嗎?謝謝。
給圖像路徑位置 – jose