Skip to content

Web-widget integration with Angular app help #92

Description

@raybuckup

Hi,

I am trying to use the web-widget-sdk with an angular app. Here is what I tried:

Angular component:

import { Component, ViewChild, AfterViewInit, ElementRef } from '@angular/core';
import * as widgetSdk from "@mxenabled/web-widget-sdk";

@Component({
  selector: 'app-mx',
  templateUrl: './mx.component.html',
  styleUrls: ['./mx.component.scss']
})
export class MxComponent implements AfterViewInit {
  @ViewChild("mxContainer") mxContainer!: Element;
  private mxWidget: any;
  constructor() {

  }

  ngAfterViewInit(): void {
    console.log(this.mxContainer);
      this.mxWidget = new widgetSdk.ConnectWidget({
        container: this.mxContainer,
        url: "https://int-api.mx.com/users/{{userid}}/widget_urls",
        clientId: "client_id",
        apiKey: "{{api_key}}",
        clientRedirectUrl: ""
      });

  }
}

HTML page:

<div #mxContainer></div>

Error I get when I run the app:

image

Do you have any documentation on how to integrate this in Angular app?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions