diff --git a/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts b/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts index df2dc6254..aae78ae58 100644 --- a/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts +++ b/cockpit/render/computed-functions/angular/src/app/computed-functions.component.ts @@ -35,10 +35,10 @@ import { toDisplayText } from '../../../../shared/to-display-text'; } `, template: ` - @if (label() || value()) { + @if (displayValue()) {
{{ label() }}: - {{ value() }} + {{ displayValue() }}
} @else if (loading()) {
@@ -49,6 +49,9 @@ import { toDisplayText } from '../../../../shared/to-display-text'; class DemoValueComponent { readonly label = input(''); readonly value = input(''); + // Coerce through toDisplayText so an unresolved binding object mid-stream + // (e.g. a partial `$computed` value) renders as the skeleton, not `[object Object]`. + readonly displayValue = computed(() => toDisplayText(this.value())); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({}); diff --git a/cockpit/render/state-management/angular/src/app/state-management.component.ts b/cockpit/render/state-management/angular/src/app/state-management.component.ts index 333d513b0..5f3cde4b5 100644 --- a/cockpit/render/state-management/angular/src/app/state-management.component.ts +++ b/cockpit/render/state-management/angular/src/app/state-management.component.ts @@ -83,10 +83,10 @@ class DemoHeadingComponent { } `, template: ` - @if (label() || value()) { + @if (displayValue()) {
{{ label() }}: - {{ value() }} + {{ displayValue() }}
} @else if (loading()) {
@@ -97,6 +97,7 @@ class DemoHeadingComponent { class DemoLabelComponent { readonly label = input(''); readonly value = input(''); + readonly displayValue = computed(() => toDisplayText(this.value())); readonly childKeys = input([]); readonly spec = input(null); readonly bindings = input>({});