Integrate button into Angular application

Angular applications are typically written in TypeScript. Below is a simple example of Angular 8 component that creates a button. Note that in your TypeScript component you need to declare a variable with exact name 'LiveAgent' (mind the capital L) to be able to use a global variable defined in track.js with the same name.

<div id="chatButton"></div>
import { Component, OnInit } from '@angular/core';

declare var LiveAgent: any;

  selector: 'app-contact',
  templateUrl: './contact.component.html',
  styleUrls: ['./contact.component.css']
export class ContactComponent implements OnInit {

  constructor() { }

  ngOnInit() {
    let scriptUrl = 'https://<youraccount>';
    let node = document.createElement('script');
    node.src = scriptUrl; = 'la_x2s6df8d';
    node.type = 'text/javascript';
    node.async = true;
    node.charset = 'utf-8';
    node.onload = function(e) {
      LiveAgent.createButton('BUTTON_ID', document.getElementById("chatButton"));

Replace <youraccount> with your LiveAgent account name and BUTTON_ID with button ID. You can copy the button ID from button's integration code in LiveAgent (see image below):