我尝试通过将其添加到 webpack/loaders 目录来设置 webpack 加载器
var path = require('path');
module.exports = {
test: /\.html$/,
loaders: [`ngtemplate?relativeTo=${path.join(__dirname, "/app")}`, "html"] //html?attrs[]=div:ng-include
}
然后从 .js 代码中要求适当的模板文件。
templateUrl: require('ngtemplate!html!./app/views/environment/index.html')
但我收到以下错误
Module not found: Error: Can't resolve 'html' in '/Users/joe/testrails5.1/app/javascript/app/scripts'
resolve 'html' in '/Users/joe/testrails5.1/app/javascript/app/scripts'
Parsed request is a module
这对其他人有用吗?我正在使用 angular 1.6,所以我需要使用不同的模块吗?