Angular Directive模板抛出错误

时间:2017-03-28 11:08:43

标签: javascript jquery angularjs node.js

我在角度指令模板中遇到了一些问题。

'use strict';

 function HomeDirective() {
  return {
    controller: 'homeController',
    template: require('./views/home.html'),

    restrict: 'AEC',
    scope: true
  }
}

module.exports = HomeDirective;

我在views文件夹中有一个模板。我的观点是

<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;

任何人都可以帮助我。问题是什么?解决方案是什么?

1 个答案:

答案 0 :(得分:1)

使用templateUrl而不是模板:Option Explicit Public Sub Compile_Workbook_Data() Dim master_wkbk As Workbook: Set master_wkbk = ThisWorkbook Dim master_sht As Worksheet: Set master_sht = ThisWorkbook.Worksheets("Task Tracking-Internal & Org.") Dim current_wkbk As Workbook Dim current_sht As Worksheet Dim wkbk_list(1 To 3) As String Dim x As Integer Dim last_row As Integer Dim last_col As Integer wkbk_list(1) = "Sub Project_WorkBook - Core Services.xlsm" wkbk_list(2) = "Sub Project_WorkBook - ESP2.0.xlsm" wkbk_list(3) = "Sub Project_WorkBook - P2E.xlsm" For x = 1 To UBound(wkbk_list) Set current_wkbk = Workbooks.Open("D:\Delta Dental\" & wkbk_list(x)) Set current_sht = current_wkbk.Worksheets("Task Tracking-Internal & Org.") last_row = current_sht.Cells.Find("*", searchorder:=xlByRows, SearchDirection:=xlPrevious).Row last_col = current_sht.Cells.Find("*", searchorder:=xlByColumns, SearchDirection:=xlPrevious).Column current_sht.Range(Cells(4, 1), Cells(last_row, last_col)).Copy last_row = master_sht.Cells.Find("*", searchorder:=xlByRows, SearchDirection:=xlPrevious).Row master_sht.Range("A" & last_row + 1).PasteSpecial Paste:=xlPasteValues current_wkbk.Close False Next x End Sub

templateUrl: 'views/home.html'