2017-12-18 248 views
2

我試圖讓我的前端應用(Angular5.1.x)來運行,但是它停止由於模板語法錯誤:「let-」只支持NG-模板元素

"let-" is only supported on ng-template elements. (" 
</thead> 
<tbody> 
<template ngFor [ngForOf]="rows" [ERROR ->]let-rowz="$implicit" let- index="index"> 
<tr *ngIf="!(datePicker.onlyCurrentMonth && rowz[0].sec"):  
ng:///DatepickerModule/[email protected]:58 
    at syntaxError (compiler.js:485) 
    at TemplateParser.parse (compiler.js:24633) 
    at JitCompiler._parseTemplate (compiler.js:34442) 
    at JitCompiler._compileTemplate (compiler.js:34417) 
    at compiler.js:34318 
    at Set.forEach (<anonymous>) 
    at JitCompiler._compileComponents (compiler.js:34318) 
    at compiler.js:34188 
    at Object.then (compiler.js:474) 
    at JitCompiler._compileModuleAndComponents (compiler.js:34187) 

我認爲我需要遵循這個主題問題,指出我需要使用ngx-bootrap @ ngx-bootstrap @ 2.0.0-beta.8,但它不適用於那個或v.2.0.0-rc.0

https://github.com/valor-software/ngx-bootstrap/issues/3024

...任何幫助表示讚賞

+3

爲什麼不能你寫的NG-模板而不是模板? – Subash

+3

模板已棄用,應使用ng-template。 –

回答

4

有在V2 +沒有<template>標籤,請不要全新安裝, 如果使用<template>已在angular 5.x.x被棄用目前

+0

感謝您的反饋valorkin,最後我不得不做一個'npm緩存清除 - 強制'以及它的工作。 –

+0

我刪除了我的節點模塊,做了'npm cache clear --force',我仍然有這個問題。使用'「ngx-bootstrap」:「^ 2.0.2」'和'「ngx-date-picker」:「0.0.24」'。 – BBaysinger

+0

刪除包鎖json文件,並再次執行它 – valorkin

1

ngx-bootstrap 1.x.x檢查是否已NGX-引導V2 + 檢查軟件包鎖定。所以你必須升級到ngx-bootstrap 2.X.X

執行以下升級

npm uninstall --save ngx-bootstrap 
npm cache clean -f 
npm install --save ngx-bootstrap