Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to pass more attributes to BlockTemplateCmp #95

Open
nepso opened this issue Mar 20, 2019 · 2 comments
Open

How to pass more attributes to BlockTemplateCmp #95

nepso opened this issue Mar 20, 2019 · 2 comments

Comments

@nepso
Copy link

nepso commented Mar 20, 2019

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.

@kuuurt13
Copy link
Owner

@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?

@nepso
Copy link
Author

nepso commented Mar 25, 2019

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants