i had impletement a google inside my app and add few marker…now i try to do a on click in the google map infowindow and push to a new page to display detail about the location but have no luck…all i found on internet is using jquery class selector to implement the onclick function…in ionic2 i have no idea how to achieve the samething
if I understand correctly, you want to be able to push a page from clicking a button? in your page template you would add (click)="function()"
where function is the function to push a page. you can also pass a parameter to the function by doing (click)="function(parameter)"
.
here’s an example for you:
example.html:
<ion-header>
<ion-navbar>
<ion-title>Page</ion-title>
</ion-navbar>
</ion-header>
<ion-content>
<ion-list>
<ion-item-sliding *ngFor="let detail of details">
<ion-item>
<h2>{{detail.title}}</h2>
<p>{{detail.content}}</p>
</ion-item>
<ion-item-options>
<button ion-button color="primary" (click)="showDetail(detail)">edit</button>
</ion-item-options>
</ion-item-sliding>
</ion-list>
</ion-content>
example.ts:
import { Component } from '@angular/core';
import { NavController } from 'ionic-angular';
import { DetailPage } from '../detail/detail;'
@Component({
selector: 'page-example',
template: 'example.html'
})
export class ExamplePage {
details: Object[] = [{
title: 'test',
content: 'test content'
}, {
title: 'test 2',
content: 'test 2 content'
}];
constructor(private nav: NavController) {}
showDetail(detail) {
this.nav.push(DetailPage, detail);
}
}
nope…i want to add a click event into InfoWindow inside google map…