Accessing component options from handler


#1

Hi,

Using Jovo v4, how to access Component config added using ComponentDeclaration (as mentioned in here: https://www.jovo.tech/docs/components#component-options)

const app = new App({
  // ...

  components: [
    new ComponentDeclaration(GlobalComponent, {
      config: {key1: 'val1'} // <<<<<<< how to access this in handler?
    }),
  ],

  // ...
});

I tried this.$component.config, but is coming as undefined

Thanks.


#3

If I’m reading the doc correctly: Try this.$component.data.config


#4

This is the correct way (going to update the docs), but we found a small bug that doesn’t add the config for global components. Going to fix this early next week. Thanks for flagging!


#5

Thanks for confirming


#6

@jan Can you please let me know if this fix was released? Thanks


#7

Currently working on it in this PR: https://github.com/jovotech/jovo-framework/pull/1148