Я пытаюсь создать пользовательскую диалоговую службу. Для этого я создал диалоговую службу:
import {DialogService,DialogRef,DialogCloseResult } from '@progress/kendo-angular-dialog';
import {Injectable} from "@angular/core";
import {CustomComponent} from './custom.component';
@Injectable()
export class DialogoService {
constructor(private dialogService: DialogService) { }
public confirm(title: string, content?: string): DialogRef {
return this.dialogService.open({
title: title,
content: CustomComponent ,//This is my component that holds the template
actions: [
{text: 'Yes', primary: true},
{text: 'No'}
]
});
} }
А это мой CustomComponent
import {Component} from '@angular/core';
@Component({
moduleId : module.id,
selector: 'customcomponent',
templateUrl: './custom.component.html'
})
export class CustomComponent {
content : string ;
}
И, наконец, мой custom.component.html:
<div> Content: {{content}} </div>
Как мне отправить параметр содержимого из службы в функцию dialogService.open?
Параметр содержимого dialogService.open может быть строкой, компонентом или TemplateRef. В моем случае я отправляю CustomComponent в качестве параметра, но не могу установить параметр заголовка для этого компонента из моей службы.
Извините за мой плохой английский. Заранее спасибо.