I created a non-angular function in my service:
import { Injectable } from '@angular/core';
@Injectable()
export class MyService {
...
}
const myFunction = function(){
alert ( 'test' );
}
And now, I want to call myFunction from the index.html, so I put this in my index.html
<script>setTimeout(function(){ myFunction(); }, 5000);</script>
And I take this error:
Uncaught ReferenceError: myFunction is not defined
at index.html:15
at ZoneDelegate.invokeTask (zone.js:414)
at Zone.runTask (zone.js:181)
at ZoneTask.invoke (zone.js:476)
at timer (zone.js:1491)
(anonymous) @ index.html:15
ZoneDelegate.invokeTask @ zone.js:414
Zone.runTask @ zone.js:181
ZoneTask.invoke @ zone.js:476
timer @ zone.js:1491
How I could call myFunction?