ng-block-ui
ng-block-ui copied to clipboard
How to pass more attributes to BlockTemplateCmp
when starting blockUi I can provide only message. Right now I created custom interface BlockTemplateConfig and I am "hijacking" the message to pass whole object like this:
export class BlockTemplateCmp { @Input() message: BlockTemplateConfig; } this.blockUIElement.start({...} as BlockTemplateConfig);
but it would be nice to have in the start method some 3rd attribute like 'context' where anyone can pass any custom data for block template component.
@nepso so it is possible pass multiple attributes if needed by using an object, which it looks like you are doing in your example. So correct me if I am wrong but your suggested change would be like so...
// Current:
this.blockUIElement.start({
message: 'test message',
foo: 'bar'
} as BlockTemplateConfig);
// Suggested:
this.blockUIElement.start('test message', {
foo: 'bar'
} as BlockTemplateConfig);
If that is the case, I'm having a hard time seeing too much value added by it being passed as a second argument. Is there any issues or edge cases that the current way isn't achieving?
@kuuurt13 I think that it would be the best to just rename 'message' to something like data/options/context, so it would be more clear that there can be any configuration for BlockTemplateCmp, because message implies some string message. But as it is breaking change I proposed to add a second argument.
Anyway no big deal, because I guess people are already using message as context and pass there whatever they need.