You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Loop over the user-provided inputs, check if each provided input is declared in the component as input. a component input is a field decorated with @Input.
privatevalidateInputs(componentInputs: ComponentInputs,userInputs: UserInputs){constuserInputsKeys=Object.keys(userInputs);userInputsKeys.forEach(userInputKey=>{constcomponentHaveThatInput=componentInputs.some(componentInput=>componentInput.templateName===userInputKey);if(!componentHaveThatInput){thrownewError(`Input ${userInputKey} is not ${this.component.name} input.`);}});}
Outputs
Loop over the component outputs, check if each output holds an instance of EventEmitter. a component output is a field decorated with @Output and has EventEmitter instance as value.
in the other part we perform a loop over the user-provided outputs, check if each provided output is declared in the component as Output and if the user-provided output is function. that function will be used as EventEmitter handler.
privatevalidateOutputs(componentOutputs: ComponentOutputs,userOutputs: UserOutputs,componentInstance: any){componentOutputs.forEach((output)=>{if(!(componentInstance[output.propName]instanceofEventEmitter)){thrownewError(`Output ${output.propName} must be a typeof EventEmitter`);}});constoutputsKeys=Object.keys(userOutputs);outputsKeys.forEach(key=>{constcomponentHaveThatOutput=componentOutputs.some(output=>output.templateName===key);if(!componentHaveThatOutput){thrownewError(`Output ${key} is not ${this.component.name} output.`);}if(!(userOutputs[key]instanceofFunction)){thrownewError(`Output ${key} must be a function`);}});}
The text was updated successfully, but these errors were encountered:
Inputs
Loop over the user-provided inputs, check if each provided input is declared in the component as input. a component input is a field decorated with
@Input
.Outputs
Loop over the component outputs, check if each output holds an instance of
EventEmitter
. a component output is a field decorated with@Output
and hasEventEmitter
instance as value.in the other part we perform a loop over the user-provided outputs, check if each provided output is declared in the component as Output and if the user-provided output is function. that function will be used as
EventEmitter
handler.The text was updated successfully, but these errors were encountered: