My expectation was that using view-model.ref would allow me to access the viewmodel of a component from outside the component and call its functions.
The following code leads to an error message: "Cannot read property 'LoadForAdditionalLocations' of undefined."
Component being Imported
export class UserLocationSelector {
public LoadForAdditionalLocations(reportLogin:string, addLocationsLogin:string){
///do stuff
}
}
Page where the component is used (TypeScript file)
export class AddLocation{
attached(){
this.UserLocationSelector.LoadForAdditionalLocations("user1","user2");
}
}
Page where the component is used (HTML file)
<template>
<require from='user-location-selector'></require>
<div>
<user-location-selector view-model.ref="UserLocationSelector"></user-location-selector>
</div>
</template>