# Loading Template

Transloco allows you to define a loading template that will be used while the translation file is being loaded.

You can use the `provideTranslocoLoadingTpl` function in lazy module providers, component providers, in the template, or even in the `AppModule`/`app.config.ts` to apply it globally across the app.

### Using `provideTranslocoLoadingTpl` in a component

{% code title="my-comp.component.ts" %}

```typescript
@Component({
  selector: 'my-comp',
  templateUrl: './my-comp.component.html',
  providers: [provideTranslocoLoadingTpl('<p>Loading...</p>')],
})
export class MyComponent {}
```

{% endcode %}

This accepts raw HTML or a custom Angular component.

### Using it directly in the template:

{% code title="my-comp.component.html" %}

```html
<ng-container *transloco="let t; loadingTpl: loading">
  <h1>{{ t('title') }}</h1>
</ng-container>

<ng-template #loading>
  <h1>Loading...</h1>
</ng-template>
```

{% endcode %}

This allows you to display a loading template while the translations are being fetched.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://jsverse.gitbook.io/transloco/additional-functionality/loading-template.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
