I have a problem that I still can not solve and I want to ask for your help.
I am using angle 5 and it happens to me that when I use plugins or external libraries in the first load they work perfectly but when I navigate through [routerLink] it automatically loses the functionality of said plugin.
For example in my index.html I have this script:
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCbeBYsZSDkbIyfUkoIw1Rt38eRQOQQU0o"></script>
This is the api of google maps I am using it to show a location on the map, in my component I have this:
ngAfterViewInit() {
google.maps.event.addDomListener(window, 'load', this.initialize);
}
initialize() {
const mapOptions = {
zoom: 17,
scrollwheel: false,
center: new google.maps.LatLng(-12.137631, -76.979471),
styles: []
};
const map = new google.maps.Map(document.getElementById('googleMap'),
mapOptions);
const marker = new google.maps.Marker({
position: map.getCenter(),
animation: google.maps.Animation.BOUNCE,
icon: 'assets/images/map.png',
map: map
});
}
my problem is how I described it, the first load makes it perfect, but when navigating using the [routerLink] directive it is not automatically shown, this happens to me with several apis, plugins or libraries.