Posted 5 July 2022, 4:42 am EST
I’m dynamically assigning to a WjMenu in Angular, and I have two issues.
- Assigning to the [command] property in the template generates a compilation error:
error NG8002: Can't bind to 'command' since it
isn't a known property of 'wj-menu'.
As a workaround, I programmatically assign to the wjMenu.command property when my component is initialised, and everything works as expected.
- I have to declare my command object as “any”, as “ICommand” doesn’t seem to be exported from the index for the input module:
/**
* Interface implemented by command objects.
*
* For details, please see the {@link Menu.command} property.
*/
interface ICommand {
/**
* Executes the command with a given parameter.
*
* The parameter passed to the command is defined by the value of the
* {@link Menu.commandParameterPath} property of the current item.
* If the {@link Menu.commandParameterPath} property is not specified,
* the parameter passed is the item itself.
*/
executeCommand(parameter: any): void;
/**
* Returns true if the command can be executed in the current app state.
*
* If this method returns false, the corresponding menu option is
* disabled.
*/
canExecuteCommand?(parameter: any): boolean;
}
The signature is trivial to get right and it all hangs together, but is there some other way I should be referencing it or is it just an omission?