Primeng: 'ng-template' is not a known element:

Created on 17 Mar 2017  路  13Comments  路  Source: primefaces/primeng

After adding FileUpload I got this runtime error:
image

Other components(radio, checkbox) work fine.

My project is based on https://github.com/aspnet/JavaScriptServices/tree/dev/templates/Angular2Spa

In webpack(webpack.config.vendor.js) I'm referencing these dependencies:
'primeng/components/fileupload/fileupload',
'primeng/components/fileupload/fileupload.css',

And FileUploadModuleis registered in app.module.ts.

Any ideas?

Most helpful comment

@balajiswaroop

I am getting the below error.
'ng-template' is not a known element:

I had exactly the same problem today on
"primeng": "^2.0.4",
"@angular/core": "2.4.9",

found a solution:
use 'template' instead of 'ng-template' in your html template.

I think that errors appears because of version, that is ng-template added only in Angular 4 core.

All 13 comments

"PrimeNG 4 requires Angular 4, if you are on Angular 2 use PrimeNG 2.0.x instead."

After downgrading to 2.0.x, problem sorted.

I am getting the below error.

'ng-template' is not a known element:

package.json

"primeng": "^2.0.4",
"@angular/core": "^2.4.0",

app.module.ts

Imported the below modules
DataTableModule,
SharedModule

Looks like its unable to find the module in which the "ng-template" directive is present.
Please help.

got the same error -
my html is --




{{car.brand}} - {{car.year}} - {{car.color}}




component-ts -just the 2 lists initialised with data


App.Module
import {PickListModule, ConfirmDialogModule, SharedModule} from from 'primeng/primeng';
@NgModule({
imports: [PickListModule, ConfirmDialogModule, SharedModule]

But for me my other code with DataTableModule works fine

@balajiswaroop

I am getting the below error.
'ng-template' is not a known element:

I had exactly the same problem today on
"primeng": "^2.0.4",
"@angular/core": "2.4.9",

found a solution:
use 'template' instead of 'ng-template' in your html template.

I think that errors appears because of version, that is ng-template added only in Angular 4 core.

using template tag works just fine, thanks a lot @AKorshunov87

ng-template is Angular4 only, you need to target primeng version which is build for Angular2

template worked for me too. Thanks!

template worked for me too. Thank you!!

template work for me too !! just find mutliselect-dropdown.ts replace ng-template with template

I'm getting the same error..but I couldn't find where to replace the ng-template to just template. Help plz...

@lucky9abhi you can find this file "mutliselect-dropdown.ts" inside node_modules folder with package name you installed.

use only template is work fine . thank you

i'm getting same error, when using p-picklist in ngprime, can you please tell me how to use "template" insted of "ng-template"?

i'm getting error:

zone.js:522 Unhandled Promise rejection: Template parse errors:
"let-" is only supported on template elements. ("gleave)="onListDragLeave()" (drop)="onListDrop($event, -1)">
]let-item [ngForOf]="source" let-i="index" let-l="last">

  • @17:39
    "let-" is only supported on template elements. ("(drop)="onListDrop($event, -1)">
    ]let-i="index" let-l="last">
  • @17:67
    "let-" is only supported on template elements. ("Drop($event, -1)">
    ]let-l="last">
  • PickList@17:81
    Can't bind to 'ngTemplateOutletContext' since it isn't a known property of 'ng-container'.

    1. If 'ng-container' is an Angular component and it has 'ngTemplateOutletContext' input, then verify that it is part of this module.
    2. If 'ng-container' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
      ("nDragStart($event, i, -1)" (dragend)="onDragEnd($event)">
      ]*ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}">
      "): PickList@24:42
      Property binding ngTemplateOutletContext not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". ("(dragstart)="onDragStart($event, i, -1)" (dragend)="onDragEnd($event)">
      [ERROR ->]
      "): PickList@24:28
      'ng-template' is not a known element:
    3. If 'ng-template' is an Angular component, then verify that it is part of this module.
    4. If 'ng-template' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("ve($event,-1)" (dragleave)="onListDragLeave()" (drop)="onListDrop($event, -1)">
      [ERROR ->]
      @17:20
      "let-" is only supported on template elements. ("ragleave)="onListDragLeave()" (drop)="onListDrop($event,1)">
      ]let-item [ngForOf]="target" let-i="index" let-l="last">
    5. @46:39
      "let-" is only supported on template elements. ("" (drop)="onListDrop($event,1)">
      ]let-i="index" let-l="last">
    6. @46:67
      "let-" is only supported on template elements. ("stDrop($event,1)">
      ]let-l="last">
    7. PickList@46:81
      Can't bind to 'ngTemplateOutletContext' since it isn't a known property of 'ng-container'.
    8. If 'ng-container' is an Angular component and it has 'ngTemplateOutletContext' input, then verify that it is part of this module.
    9. If 'ng-container' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message.
      ("onDragStart($event, i, 1)" (dragend)="onDragEnd($event)">
      ]*ngTemplateOutlet="itemTemplate; context: {$implicit: item, index: i}">
      "): PickList@53:42
      Property binding ngTemplateOutletContext not used by any directive on an embedded template. Make sure that the property name is spelled correctly and all directives are listed in the "@NgModule.declarations". (" (dragstart)="onDragStart($event, i, 1)" (dragend)="onDragEnd($event)">
      [ERROR ->]
      "): PickList@53:28
      'ng-template' is not a known element:
    10. If 'ng-template' is an Angular component, then verify that it is part of this module.
    11. If 'ng-template' is a Web Component then add "CUSTOM_ELEMENTS_SCHEMA" to the '@NgModule.schemas' of this component to suppress this message. ("eMove($event,1)" (dragleave)="onListDragLeave()" (drop)="onListDrop($event,1)">
      [ERROR ->]
      PickList@46:20 ; Zone: ; Task: Promise.then ; Value: SyntaxError Error:
  • Was this page helpful?
    0 / 5 - 0 ratings

    Related issues

    Helayxa picture Helayxa  路  3Comments

    markgoho picture markgoho  路  3Comments

    papiroca-tm picture papiroca-tm  路  3Comments

    Helayxa picture Helayxa  路  3Comments

    garethlewis picture garethlewis  路  3Comments