import {Component} from '@angular/core'; import {PluginBaseComponent} from "../../utils/base-plugin.component"; export class PluginTest{ title:string ="Test Plugin"; description: string = "Lorem ipsum"; numberOn:boolean = true; constructor() { console.log(this) } } @Component({ selector: 'plugin-test', template: `

{{pluginObject && pluginObject.title?pluginObject.title:pluginDefaultObject.title}}

{{pluginObject && pluginObject.description?pluginObject.description:pluginDefaultObject.description}}

58K

`, }) export class PluginTestComponent extends PluginBaseComponent{ get pluginObject():PluginTest{ return this.plugin?this.plugin.object:null; } get pluginDefaultObject():PluginTest{ return this.pluginTemplate?this.pluginTemplate.object:null; } constructor() { super() } ngOnInit(): void { if(this.pluginTemplate && (!this.pluginDefaultObject || !this.pluginDefaultObject.title)){ this.pluginTemplate.object = new PluginTest(); } } }