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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -