I have JSAngular2Demo.js in apps folder which contains a simple function :-
function sample()
{
alert("sample");
}
I want to call this function from apps.component.ts
For this:-
import {Component} from "@angular/core";
import "app/JSAngular2Demo.js";
declare function sample(): any;
@Component({ selector: "my-app", templateUrl:"app/UIAngular.html" })
export class AppComponent {
strWelcomeMessage: string = "Welcome Sagar";
constructor() {
sample.prototype.sample();
}
}
But this function is not getting called.
What can be the possible reason?