我使用的角度,我想从一个变量,它是JSON形式.I'm能够做到这一点的显示数据*ngfor而且我希望把它检查是否msg.who =="博特"的条件我正在这样做:
<div class="UserWrapper" *ngFor="let msg of msgs" ngIf="msg.who == 'User ">
<div class=""></div>
<div class = "speech-bubble1 z-depth-5"><p>{{msg.msg}}</p>
<p class="timeRight">{{msg.time}}</p>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我不知道如何使用ng如果另一种方式,但这样做我得到以下错误.
ERROR Error: StaticInjectorError(AppModule)[NgForOf -> TemplateRef]:
StaticInjectorError(Platform: core)[NgForOf -> TemplateRef]:
NullInjectorError: No provider for TemplateRef!
Run Code Online (Sandbox Code Playgroud)
我该如何检查给定的条件
为什么我什么时候会收到错误
int i=123;
byte b=i;
Run Code Online (Sandbox Code Playgroud)
但不是在这种情况下
final int i=123;
byte b=i;
Run Code Online (Sandbox Code Playgroud)