index.html
<body>
<app-root></app-root>
<script src="assets/multiLayerSource.js"></script>
</body>
multiLayerSource.js
var multiLayerSource;
var layersHT = ;
function SetLayerHT(arglayersHT) {
layersHT = arglayersHT;
}
home.page.ts
import { Component } from ‘@angular/core’;
import { OnInit, Renderer, ViewChild } from ‘@angular/core’;
declare var multiLayerSource: any;
@Component({
selector: ‘app-home’,
templateUrl: ‘home.page.html’,
styleUrls: [‘home.page.scss’],
})
export class HomePage implements OnInit {
layersHTP: any = ;
constructor() {}
ngOnInit() {
this.layersHTP.push( ‘a’, ‘b’, ‘c’, ‘d’ );
multiLayerSource.SetLayerHT(this.layersHTP);
}
}
It is showing error while trying to access SetLayerHT().
The error is :
TypeError: Cannot read property ‘SetLayerHT’ of undefined.
Please help.