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
Post a Comment