# SiWeatherIconResolver Service documentation

**Kind:** class

**Provided in:** `root`

```
import { SiWeatherIconResolver } from '@siemens/element-ng/dashboard';
```

Maps a semantic [SiWeatherIcon](<index.html#t:SiWeatherIcon>) to a renderable illustration. The library ships a [SiDefaultWeatherIconResolver](<../SiDefaultWeatherIconResolver/index.html#SiDefaultWeatherIconResolver>) that maps the built-in [SiWeatherCondition](<../../types/SiWeatherCondition/index.html#t:SiWeatherCondition>) vocabulary to Element icons, so the widget renders a reasonable illustration out of the box. Applications can override the mapping or add provider-specific vocabularies by registering their own resolver:

Example:

```ts
@Injectable({ providedIn: 'root' })
export class MyWeatherIconResolver extends SiWeatherIconResolver {
  override resolve(icon: SiWeatherIcon): SiWeatherIconResolution | null {
    // ...
  }
}
```

Resolvers SHOULD return `null` for unknown or `'unknown'` conditions so the widget can skip the illustration.

```
undecorated_class SiWeatherIconResolver
```

#### Attributes and Methods

##### resolve

[Source for resolve](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-icon.resolver.ts#L50-L50>)

```
resolve(icon: SiWeatherIcon): SiWeatherIconResolution | null
```

#### Parameters

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| [icon](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-icon.resolver.ts#L50-L50>) | `SiWeatherIcon` |  |  |

**Returns:** [SiWeatherIconResolution](<index.html#t:SiWeatherIconResolution>)`  |  `[null](<https://developer.mozilla.org/docs/Web/JavaScript/Reference/Operators/null>)

### Types Documentation

### [SiWeatherIcon](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-widget.types.ts#L33-L40>)

**Kind:** interface

```
import type { SiWeatherIcon } from '@siemens/element-ng/dashboard';
```

Describes how a weather illustration should be resolved. Callers can either provide a direct [SiWeatherIcon.src](<index.html#t:SiWeatherIcon.src>) or a semantic [SiWeatherIcon.condition](<index.html#t:SiWeatherIcon.condition>) token resolved by a [SiWeatherIconResolver](<index.html#SiWeatherIconResolver>).

```
interface SiWeatherIcon
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [alt](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-widget.types.ts#L39-L39>) (optional) | `TranslatableString` | Translatable alt text for accessibility. |
| [condition](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-widget.types.ts#L35-L35>) (optional) | `string` | Semantic condition token, used by the resolver. Apps with custom resolvers may pass any string. |
| [src](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-widget.types.ts#L37-L37>) (optional) | `string` | Direct URL/path. Wins over [condition](<index.html#t:SiWeatherIcon.condition>). |

### [SiWeatherIconResolution](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-icon.resolver.ts#L15-L22>)

**Kind:** interface

```
import type { SiWeatherIconResolution } from '@siemens/element-ng/dashboard';
```

Result returned by a [SiWeatherIconResolver](<index.html#SiWeatherIconResolver>). Implementations should return either [icon](<index.html#t:SiWeatherIconResolution.icon>) (rendered via `<si-icon>`) or [src](<index.html#t:SiWeatherIconResolution.src>) (rendered as a plain `<img>`). When both are present, [icon](<index.html#t:SiWeatherIconResolution.icon>) wins.

```
interface SiWeatherIconResolution
```

#### Properties

| Name | Type | Description |
| --- | --- | --- |
| [alt](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-icon.resolver.ts#L21-L21>) (optional) | `TranslatableString` | Resolved alt text. The widget falls back to a sensible default. |
| [icon](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-icon.resolver.ts#L17-L17>) (optional) | `string` | Resolved Element icon name (e.g. `"element-sun"`). Rendered via `<si-icon>`. |
| [src](<https://github.com/siemens/element/blob/main/projects/element-ng/dashboard/widgets/si-weather-widget/si-weather-icon.resolver.ts#L19-L19>) (optional) | `string` | Resolved image URL. Rendered as a plain `<img>`. |

### [TranslatableString](<https://github.com/siemens/element/blob/main/projects/element-translate-ng/translate-types/global.types.ts#L18-L18>)

**Kind:** type alias

```
import type { TranslatableString } from '@siemens/element-translate-ng/translate-types';
```

Represents a translatable string. This can either be a translation key, e.g. `ACTIONS.EDIT` that will be automatically translated when displayed on the UI or a pre-translated string, e.g. `Edit`. Equivalent to a normal string in usage and functionality.

```
type TranslatableString = string & Translatable
```
