在我的项目中,我尝试设置popUps的链接,比如
knex seed:run
所以,问题在于此代码的第二行
ngOnInit() {
this.ParseService.getJ().subscribe(data => {
this.myData = JSON.parse(data);
//set markers and popUps
for(let i = 0; i < this.myData.length; i++) {
let lat =+((this.myData[i])['lat']);
let lng =+((this.myData[i])['lng']);
this.id = (this.myData[i])['code'];
let popUp = (this.myData[i])['displayName'] + '<br/><a [routerLink]=["/buildings", this.id] routerLinkActive="active">room</a>';
let markerLocation = L.latLng(lat, lng);
let marker = new L.Marker(markerLocation, {icon: customIcon});
map.addLayer(marker);
marker.bindPopup(popUp);
}
});
如果我用
替换它 let popUp = (this.myData[i])['displayName'] +
'<br/><a [routerLink]=["/buildings", this.id] routerLinkActive="active">room</a>';
它有效。
问题是什么,为什么routerLink不起作用?..