Suppose we first check whether a resource is not loading like this:
@if (!countriesResource.isLoading()) {
<ul>
@for (
country of countriesResource.value();
track country.name.official
) {
<li>{{ country.name.official }}</li>
}
</ul>
If the resource is not loading, however has not initiated a request yet, is there a way to provide an initial value so that countriesResource.value()
resolves to an initial value?
Does the Angular resource API support adding an initial value for the resource
Today no.
But keep in mind that resource
is an experimental API and the Angular team plan to have an RFC on the concept of resource
in the following week.