The scope of expressions in the view binding is limited to an instance of the component class. There is no support for accessing statistics, global variables, types (enumerations), ... directly from the view.
To be able to refer to it in the view, it must be accessible through an instance of the component class:
constructor(public utilsService:UtilsService) {}
<button name="getsession" (click)="utilsService.getSessionId()">Get Session</button>
source
share