# Services

## Services are singletons ( Style 07-01)

* Use services as singletons within the same injector. Use them for sharing data and funcionality.

## Single responsability (Style 07-02)

* create services with a single responsibility that is encapsulated by its context.

## Providing a services (Style 07-03)

* Provide services to the Angular injector at the top-most component where they will be shared.

## Use the @Injectable() class decorator (Style 07-04)

* Use the **@Injectable** class decorator instead of the **@Inject** parameter decorator when using types as tokens for the dependencies of a services.

```typescript
@Injectable()
export class HeroArena {
  constructor(
    private heroService: HeroService,
    private http: Http) {}
}
```


---

# 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://docs.gapvelocity.ai/webmap/general/frontend/documentation/winforms-angular-components/conventions/services.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.
