im neu Typoskript und Winkel 2 und was im Versuch zu tun ist Singletone erstellen verwendet werden, wo immer nötig ist, aber im immer diese Fehlermeldung:Winkel 2 Typoskript schaffen Singletone
Unexpected value 'ViewHelperComponent' declared by the module 'AppModule'
im Browser-Log , Was mache ich falsch?
ist dies die Klasse:
export class ViewHelperComponent {
static instance : ViewHelperComponent;
constructor() {}
public static getInstance(){
if(ViewHelperComponent.instance == null)
ViewHelperComponent.instance = new ViewHelperComponent();
return ViewHelperComponent.instance;
}
check(){
console.log("working");
}
}
und aus dieser Komponente im Aufruf:
import { Component} from '@angular/core';
import { ViewHelperComponent } from '../view-helper/view-helper';
@Component({
selector: 'app-input-parent',
templateUrl: './input-parent.component.html',
styleUrls: ['./input-parent.component.css']
})
export class InputParentComponent implements OnInit {
temp : ViewHelperComponent;
constructor() {
this.temp = ViewHelperComponent.getInstance()
}
}