When using components as content within a Polymorpheus outlet, you can access the provided context using the injectContext helper or the POLYMORPHEUS_CONTEXT token.
Note: The context object is live. Any changes made to the context object in the host component will automatically trigger updates in the dynamic component's view.
Alternatively, you can use Angular input() signals. If the keys in the context object match the names of your inputs, they will be automatically synced with the context changes.
import {injectContext} from '@taiga-ui/polymorpheus';
@Component({
template: '{{ context.active }}',
})
export class MyComponent {
// The context object is live and updates the view automatically
protected readonly context = injectContext<{active: boolean}>();
}
Or using inputs for automatic syncing:
import {input} from '@angular/core';
@Component({
template: '{{ active() }}',
})
export class MyComponent {
// Automatically updated by context.active changes
protected readonly active = input(false);
}