var uib = $uibModal.open(
{
template: require('./create/create.html'),
}
)
我想在创建中获取内容.html并在模态中显示它,但它显示./create/create.html
,模态中位置的字符串。
我在 webpack.config 中添加了 html 加载器.js:
{
test: /.html$/,
loader: 'raw-loader',
},
你应该使用templateUrl
var uib = $uibModal.open({
templateUrl: require('./create/create.html'),
});
当您想在js
中声明 HTML 代码时,您可以使用template
但是如果你想像create.html
那样调用HTML页面,你必须通过templateUrl
调用它
您也可以用template
编写代码,例如:-
var uib = $uibModal.open({
template: '<html><h3> Hie i am in js </h3></html>'
});