javascript - Angular Directive template throw an error -


i have problem in angular directive templating.

'use strict';   function homedirective() {   return {     controller: 'homecontroller',     template: require('./views/home.html'),      restrict: 'aec',     scope: true   } }  module.exports = homedirective; 

i have template in views folder.my views

<div> <p>this home page.you can nevigate page</p> <p>the content {{test}}</p> </div> 

the error following

<div>                                                                              ^                                                                                parseerror: unexpected token                                                         @ wrapwithpluginerror (c:\users\dat-asset-110\desktop\test  code\anguler_test_structure\node_modules\gulp-browserify\index.js:44:10)  

it working when use

'use strict';   function homedirective() {     return {     controller: 'homecontroller',     template: '<div><p>this home page.you can nevigate page</p>    <p>the content {{test}}</p></div>',     restrict: 'aec',     scope: true   }  }   module.exports = homedirective; 

can me.what problem , solution of it?

use templateurl instead of template: templateurl: 'views/home.html'

'use strict';   function homedirective() {   return {     controller: 'homecontroller',     templateurl: 'views/home.html',      restrict: 'aec',     scope: true   } }  module.exports = homedirective; 

Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -