[Solved] how to call method of event in ngOnInit
You cannot do this reliably. After the component is created, event listener (@HostListener) are setup and ngOnInit is called by the framework. The listener will only react to the event you specify (in your case document:mousemove). If you wanted this value, the event would need to be fired between component creation (calling the constructor) and … Read more