🚀 feature request
Relevant Package
@angular/elements
Description
There is no "easy" way to pass custom lifecycle callbacks for CustomElements.
We may pass a custom NgElementStrategyFactory to createCustomElement, but when looking at ComponentNgElementStrategy, this is not something that should be done by the average angular developer.
Describe the solution you'd like
- Suggestion: You may expose ComponentNgElementStrategy. That way we could extend it and override the methods + call the super methods.
- Suggestion: Extend
createCustomElement to directly pass the optional custom callbacks, which in turn are called internally. Maybe an object of:
export interface CustomElementCallbacks {
/** When upgraded, its constructor is run, with no arguments */
constructedCallback()?: void;
/** When it becomes connected, its connectedCallback is called, with no arguments */
connectedCallback()?: void;
/** When it becomes disconnected, its disconnectedCallback is called, with no arguments */
disconnectedCallback()?: void;
/** When it is adopted into a new document, its adoptedCallback is called, given the old document and new document as arguments */
adoptedCallback()?: void;
/**
* When any of its attributes are changed, appended, removed, or replaced,
* its attributeChangedCallback is called, given
* the attribute's local name, old value, new value
*/
attributeChangedCallback(attrName: string, oldVal?: any, newVal?: any)?: void;
}
Describe alternatives you've considered
Just copy the code from here? (Not thinking about compatibility on version changes, though....)
🚀 feature request
Relevant Package
@angular/elements
Description
There is no "easy" way to pass custom lifecycle callbacks for CustomElements.
We may pass a custom NgElementStrategyFactory to
createCustomElement, but when looking at ComponentNgElementStrategy, this is not something that should be done by the average angular developer.Describe the solution you'd like
createCustomElementto directly pass the optional custom callbacks, which in turn are called internally. Maybe an object of:Describe alternatives you've considered
Just copy the code from here? (Not thinking about compatibility on version changes, though....)