【发布时间】:2017-08-21 10:23:24
【问题描述】:
我在 Angular 指令模板中遇到了一些问题。
'use strict';
function HomeDirective() {
return {
controller: 'homeController',
template: require('./views/home.html'),
restrict: 'AEC',
scope: true
}
}
module.exports = HomeDirective;
我在视图文件夹中有一个模板。我的视图是
<div>
<p>This is Home Page.You can nevigate to any page</p>
<p>The Content is {{test}}</p>
</div>
错误如下
<div>
^
ParseError: Unexpected token
at wrapWithPluginError (C:\Users\DAT-Asset-110\Desktop\Test
Code\anguler_test_structure\node_modules\gulp-browserify\index.js:44:10)
当我使用它时它正在工作
'use strict';
function HomeDirective() {
return {
controller: 'homeController',
template: '<div><p>This is Home Page.You can nevigate to any page</p>
<p>The Content is {{test}}</p></div>',
restrict: 'AEC',
scope: true
}
}
module.exports = HomeDirective;
谁能帮帮我。问题是什么,解决方法是什么?
【问题讨论】:
-
你在使用 webpack 来加载你的模板吗? .如果不是,那么它应该是 templateUrl 而不是 template 。
-
能否发一下使用webpack的正确链接步骤。我用的是browserify。@ShushanthPallegar
标签: javascript jquery angularjs node.js