I am trying to create a simple application with angular2, I have the following component:
@Component({ selector: 'map-menu', templateUrl: './angular-app/components/map-menu.html' }) export class MapMenuComponent { @Input() selectedMarkers: Array<google.maps.Marker>; constructor() { // setInterval(() => { // console.log(this); // }, 1000); } }
when my map-menu.html:
<ul class="nav nav-sidebar"> <li *ngFor="#marker of selectedMarkers #i = index"><a href="#">{{marker.data.name}}</a></li> </ul>
and in my html application I have:
<map-menu [selectedMarkers]="selectedMarkers"></map-menu>
and the list is not updated, BUT, when I add a commented-in setInterval, it works fine. What am I missing there?
I created plunker using solution
angular google-maps google-maps-api-3 angular2-template angular2-directives
DiSol
source share