mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Adds an enhanced route data tree view to better visualize both route resolvers and router data.
59 lines
1.6 KiB
HTML
59 lines
1.6 KiB
HTML
<th>{{label()}}</th>
|
|
<td>
|
|
@switch (type()) {
|
|
@case ('flag') {
|
|
<span [class]="rowValue() ? 'tag-active' : 'tag-inactive'">
|
|
{{ rowValue() || 'false' }}
|
|
</span>
|
|
}
|
|
@case ('list') {
|
|
@for (provider of dataArray(); track $index) {
|
|
<div class="value-container">
|
|
<span>{{ provider || '[empty string] ' }}</span
|
|
><ng-container
|
|
[ngTemplateOutlet]="actionBtn"
|
|
[ngTemplateOutletContext]="{ value: provider }"
|
|
/>
|
|
</div>
|
|
}
|
|
}
|
|
@default {
|
|
@if (rowValue() && renderValueAsJson()) {
|
|
<ng-route-data-tree
|
|
(viewSource)="actionBtnClick.emit($event)"
|
|
[showViewSourceButton]="actionBtnType() === 'view-source'"
|
|
[data]="rowValue()"
|
|
/>
|
|
} @else {
|
|
<div class="value-container">
|
|
<span> {{ rowValue() || '[empty string] ' }} </span
|
|
><ng-container
|
|
[ngTemplateOutlet]="actionBtn"
|
|
[ngTemplateOutletContext]="{ value: rowValue() }"
|
|
/>
|
|
</div>
|
|
}
|
|
}
|
|
}
|
|
</td>
|
|
|
|
<ng-template #actionBtn let-value="value">
|
|
@if (actionBtnType() !== 'none') {
|
|
<button
|
|
ng-button
|
|
btnType="icon"
|
|
(click)="actionBtnClick.emit(value)"
|
|
[matTooltip]="!actionBtnDisabled() ? actionBtnTooltip() || value : null"
|
|
[disabled]="actionBtnDisabled()"
|
|
>
|
|
@switch (actionBtnType()) {
|
|
@case ('view-source') {
|
|
<mat-icon class="view-source">code</mat-icon>
|
|
}
|
|
@case ('navigate') {
|
|
<mat-icon class="navigate">output</mat-icon>
|
|
}
|
|
}
|
|
</button>
|
|
}
|
|
</ng-template>
|