jan*_*kau 93 html templates angular
ngIf没有额外的容器元素我可以使用吗?
<tr *ngFor="...">
<div *ngIf="...">
...
</div>
<div *ngIf="!...">
...
</div>
</tr>
Run Code Online (Sandbox Code Playgroud)
它在表中不起作用,因为这会产生无效的HTML.
Ale*_*lor 144
ng-container优先于template:
<ng-container *ngIf="expression">
Run Code Online (Sandbox Code Playgroud)
看到:
https://github.com/angular/angular.io/issues/2303
jan*_*kau 19
我找到了一种方法:https://angular.io/docs/ts/latest/guide/template-syntax.html#!# star-template.
你可以简单地使用<template>标签和替换*ngIf用[ngIf]这样的.
<template [ngIf]="...">
...
</template>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
37994 次 |
| 最近记录: |