angular 5: templateRef.createEmbeddedView is not a function

后端 未结 5 1148
忘掉有多难
忘掉有多难 2020-12-29 03:58

Here\'s the code I\'m trying to get to work (angular 5):

  import { Component, ViewChild, TemplateRef, ViewContainerRef } from \'@angular/core\';

@Component         


        
5条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 04:03

    When you reference in the *ngIf, else clause can’t be any arbitrary component, but it must be a ng-template.

    For eg,

    in a component where you have a source code similar to this:

    The resulting source code should look like this:

    ref : https://techoverflow.net/2018/02/17/how-to-fix-angular-typeerror-templateref-createembeddedview-is-not-a-function/

提交回复
热议问题