javascript - Why I get a location string when requiring a html file in webpack? -
var uib = $uibmodal.open( { template: require('./create/create.html'), } )
i want content in create.html , show in modal,but shows ./create/create.html
,the string of location in modal.
i've add html loader in webpack.config.js:
{ test: /\.html$/, loader: 'raw-loader', },
you should use templateurl
var uib = $uibmodal.open({ templateurl: require('./create/create.html'), });
when want declare html code in js
time can use template
if want call html page create.html
time have call templateurl
also can write code in template
:-
var uib = $uibmodal.open({ template: '<html><h3> hie in js </h3></html>' });
Comments
Post a Comment