-
Probably a noob question there. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
@cmalosse You'd need to use an InjectionToken or a Service
export const SELECTED_ID = new InjectionToken<number>('selectedId');
// can also be an Observable: export const SELECTED_ID = new InjectionToken<Observable<number>>('selectedId$');
@Component({/* */)
export class PreviewScene {
readonly selectedId = inject(SELECTED_ID);
// or use constructor(@Inject(SELECTED_ID) private readonly selectedId: number) {}
}
// provide the token with: {provide: SELECTED_ID, useValue/useFactory etc...} |
Beta Was this translation helpful? Give feedback.
@cmalosse You'd need to use an InjectionToken or a Service
selectId
is set once, use regularnumber
selectId
can change, useObservable<number>