我正在尝试使用 ng-include 将一个 html 文件包含到另一个 html 中。跟随这个没有运气,可能是由于 webpack 版本的差异。
尝试在 ng-include 中查找文件时出现 404 错误
包.json
"devDependencies": {
..//other dependencies
"required-loader": "^1.3.15",
"extract-text-webpack-plugin": "^3.0.1",
"file-loader": "^1.1.5",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^2.30.1",
..//other dependencies
}
index.js(应用程序的入口点)
import angular from 'angular'
import uirouter from 'angular-ui-router'
import routes from './routes'
//trying to require all files inside views/all dir/all html files
//@require "../views/**/*.html"
angular.module('app', [uirouter])
.config(routes)
.controller('LoginCtrl', function() {})
需要包含 navbar.html 文件的 index.html 文件
index.html
views
--> common
--> navbar.html
索引.html
<div ng-include="'navbar.html'">