Answers:
您错过了*NgIf的前面(就像我们所有人一样,数十次):
<div *ngIf="answer.accepted">✔</div>
如果没有使用*,Angular会发现ngIf指令已应用于div元素,但是由于没有*或<template>标签,它无法定位模板,因此会出现错误。
如果您在Angular v5中遇到此错误:
错误:StaticInjectorError [TemplateRef]:
StaticInjectorError [TemplateRef]:
NullInjectorError:没有TemplateRef提供者!
您可能具有<template>...</template>一个或多个组件模板。将标签更改/更新为<ng-template>...</ng-template>。