У меня есть служба для загрузки и сохранения шаблонов, и я хочу, чтобы при нажатии кнопки ion-select параметры загружались динамически, чтобы каждый сохраненный шаблон представлял собой параметр вместо жестко заданных параметров.
Я попытался использовать NgFor и создать экземпляр службы, которая обрабатывает шаблоны в файле JS.
Вот код HTML
```
<ion-item>
<ion-label>Load template</ion-label>
<ion-select>
<ion-option *ngFor = "let template of templates;">
{{templates}}
</ion-option>
</ion-select>
</ion-item>
```
Вот шаблон сервисного кода
```
export class TemplateService {
public templates: Template[] = [];
...
getAllTemplates(): Template[] {
return this.templates;
}
```
Вот код JS
```
export class NewTransactionPage {
templates: Template[];
...
constructor(public templateServicerino: TemplateService) {
this.templates = this.templateServicerino.getAllTemplates();
```
Я получаю сообщение об ошибке «Uncaught (в обещании): ошибка: StaticInjectorError (AppModule) [NewTransactionPage -> TemplateService: StaticInjectorError (Platform: core) [NewTransactionPage -> TemplateService: NullInjectorError: Нет поставщика для службы шаблонов!»