breeze-client
breeze-client copied to clipboard
how to access methods from initializer?
I am registering a custom constructor as per the below: metadataStore.registerEntityTypeCtor('Client', Client, 'initializer');
How can i access this 'this' from the initalizer? I am trying to execute a method on propertyChanges.
initializer(entity: Client) {
entity.entityAspect.propertyChanged.subscribe((changes)=>{
this.refreshAdditionalProperties();
}
}
refreshAdditionalProperties()
{
Do something cool.
}
What are you expecting this to be? The initializer is just a function. It gets the entity passed as the argument, so you can call any method on it, but as far as referring to anything else outside the initializer function goes, you gonna have to use a closure to capture whatever you need, or bind this using bind to what you need it to be.