Adds a model to the container.
The model instance to add
Adds multiple models to the container at once.
Array of model instances to add
Core container that manages the collection of models. Provides methods to add, remove, and query model instances. Automatically injected by
decorator.
Readonly modelsThe container instance managing the models. Readonly property that provides access to the KosModelContainer. Compatible with IKosModelHolder interface. Updates automatically when models are added or removed.
Reactive array of all model instances in the container. This is the actual array of models, compatible with IKosModelHolder interface. Updates automatically when models are added or removed.
Interface for models using
Kos Container Aware
decorator.
IMPORTANT: Use TypeScript interface merging to add container management properties to your model class. This provides full type safety and IntelliSense support for all injected container functionality.
Interface Merging Pattern
Custom Container Property Name
When using a custom
containerPropertyname, useKosContainerAwareWithProp:Injected Properties and Methods
The decorator automatically injects the following members (configurable via options):
container: Core KosModelContainer instance for direct access (or custom name viacontainerProperty)getModel(id): Retrieve a model by ID from the containeraddModel(model): Add a model to the containerremoveModel(id): Remove a model from the container by ID (does not destroy)addAll(models): Add multiple models to the container at onceremoveAll(ids): Remove multiple models from the container by IDs (does not destroy)removeAndDestroy(id): Remove a model from the container and destroy itremoveAndDestroyAll(ids): Remove multiple models from the container and destroy themmodels: Readonly KosModelContainer instance (compatible with IKosModelHolder)data: Reactive array of all model instances (compatible with IKosModelHolder)All injected getters are reactive and will automatically update UI components when container contents change.
Example
Example
See