Presumably the simplest way to use compose
is with a View only. This allows you to include HTML templates without the need to declare a ViewModel with bindable properties for each of them, making it easier to reuse smaller pieces of HTML.
The BindingContext (ViewModel) of the View will be set to that of the parent ViewModel.
Usage:
src/app.html
<template>
<compose view="./greeter.html"></compose>
</template>
src/greeter.html
<template>
<h1>Hello, ${name}!</h1>
</template>
src/app.ts
export class App {
/* This property is directly available to the child view
because it does not have its own ViewModel */
name = "Rob";
}