3
我構建了一個angular2 webpack應用程序。如何包含來自angular2 webpack資產的圖像
把圖像中的'的src /資產/圖像/爲Default.png'
和webpack.common.js:
new CopyWebpackPlugin([{
from: 'src/assets',
to: 'assets'
}]),
{ test: /\.(jpg|png|gif)$/, loader: 'file' },
new AssetsPlugin({
path: helpers.root('dist'),
filename: 'webpack-assets.json',
prettyPrint: true
}),
當我包括像這樣的模板:
<img [src]="path" width="160" height="200" />
this.path='assets/images/default.png';
圖片未加載。