private embedNew()

in src/service.ts [375:394]


  private embedNew(element: IPowerBiElement, config: IComponentEmbedConfiguration | IEmbedConfigurationBase, phasedRender?: boolean, isBootstrap?: boolean): Embed {
    const componentType = config.type || element.getAttribute(Embed.typeAttribute);
    if (!componentType) {
      throw new Error(`Attempted to embed using config ${JSON.stringify(config)} on element ${element.outerHTML}, but could not determine what type of component to embed. You must specify a type in the configuration or as an attribute such as '${Embed.typeAttribute}="${Report.type.toLowerCase()}"'.`);
    }

    // Saves the type as part of the configuration so that it can be referenced later at a known location.
    config.type = componentType;

    const Component = utils.find((embedComponent) => componentType === embedComponent.type.toLowerCase(), Service.components);
    if (!Component) {
      throw new Error(`Attempted to embed component of type: ${componentType} but did not find any matching component.  Please verify the type you specified is intended.`);
    }

    const component = new Component(this, element, config, phasedRender, isBootstrap);
    element.powerBiEmbed = component;

    this.addOrOverwriteEmbed(component, element);
    return component;
  }