13

I am trying to get my frontend-application(Angular5.1.x) to run but it stops due to template parse error:

"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/DayPickerComponent.html@52: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)

I figured I need to follow this on-topic issue, stating I need to use ngx-bootrap@ngx-bootstrap@2.0.0-beta.8, but it doesnt work with that or v.2.0.0-rc.0

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

...any help is appreciated

Leif Walder
  • 133
  • 1
  • 1
  • 6

7 Answers7

11

I have encountered this error when upgraded from Angular 4.x.x to 5.x.x. Original code was:

<template let-item>

</template>

This worked fine in Angular 4, but failed in 5. Simply using ng-template worked correctly (no packages installation was required, no cache clean required):

<ng-template let-item>

</ng-template>
Alexei - check Codidact
  • 22,016
  • 16
  • 145
  • 164
7

ngx-bootstrap 1.x.x using <template> which has been deprecated in angular 5.x.x. so you have to upgrade to ngx-bootstrap 2.X.X

Do following to upgrade

npm uninstall --save ngx-bootstrap
npm cache clean -f
npm install --save ngx-bootstrap
Kalim ul Haq
  • 196
  • 1
  • 10
4

there are no <template> tags in v2+, please do clean install, and check that you have ngx-bootstrap v2+ check package lock if present

valorkin
  • 1,329
  • 9
  • 20
2

Just search all

  1. <template and replace with <ng-template

  2. </template> and replace with </ng-template>

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Ahmed Adewale
  • 2,943
  • 23
  • 19
0

It was also facing the same issue. by the issue found that the array which i created was

<ng-template  ngFor [ngForOf]="names" let-name="$implicit" let-i="index">
  <div><span>{{i+1}}</span> <span> {{name.name}}</span></div>
</ng-template>

like :-

names= [{id:1,name:'shashikant'},{id:2,name:'Rakesh'},{id:3,name:'Umesh'}];

then i replace by :-

names:Array<any>= [{id:1,name:'shashikant'},{id:2,name:'Rakesh'},{id:3,name:'Umesh'}];

specified the type to Array

Shashikant Pandit
  • 2,752
  • 22
  • 29
0

You do not use ng-template tags in html file but you have import ngx module to you app.model.ts then this will come. remove your app.model import statement and build and check.

thank you.

-3

I face the same problem and replacing <template> tag by <ng-template> in my html files I solved the issue.

M. Gleria
  • 468
  • 5
  • 14