refactor(popover): get popover working with dom, react, angular components

This commit is contained in:
Dan Bucholtz
2017-12-14 16:21:03 -06:00
parent 85785b9cf7
commit 1ba73a5f29
18 changed files with 402 additions and 41 deletions

View File

@ -11,7 +11,8 @@ const routes: Routes = [
{ path: 'toast', loadChildren: 'app/toast/toast.module#ToastModule' },
{ path: 'loading', loadChildren: 'app/loading/loading.module#LoadingModule' },
{ path: 'nav', loadChildren: 'app/nav/nav.module#NavModule' },
{ path: 'modal', loadChildren: 'app/modal/modal.module#ModalModule' }
{ path: 'modal', loadChildren: 'app/modal/modal.module#ModalModule' },
{ path: 'popover', loadChildren: 'app/popover/popover.module#PopoverModule' },
];
@NgModule({

View File

@ -27,4 +27,7 @@
<li>
<a href='modal'>Modal Page</a>
</li>
<li>
<a href='popover'>Popover Page</a>
</li>
</ul>

View File

@ -0,0 +1,35 @@
import { Component } from '@angular/core';
@Component({
selector: 'page-one',
template: `
<ion-header>
<ion-toolbar>
<ion-title>Page One</ion-title>
</ion-toolbar>
</ion-header>
<ion-content>
Page One
<ul>
<li>ngOnInit - {{ngOnInitDetection}}</li>
</ul>
</ion-content>
`
})
export class PopoverPageToPresent {
ngOnInitDetection = 'initial';
constructor() {
}
ngOnInit() {
console.log('page one ngOnInit');
setInterval(() => {
this.ngOnInitDetection = '' + Date.now();
}, 500);
}
}

View File

@ -0,0 +1,36 @@
import { Component } from '@angular/core';
import { PopoverController } from '@ionic/angular';
import { PopoverPageToPresent } from './popover-page-to-present';
@Component({
selector: 'app-popover-page',
template: `
<ion-app>
<ion-page class="show-page">
<ion-header>
<ion-toolbar>
<ion-title>Test</ion-title>
</ion-toolbar>
</ion-header>
<ion-content padding>
<ion-button (click)="clickMe($event)">Open Basic Popover</ion-button>
</ion-content>
</ion-page>
</ion-app>
`
})
export class PopoverPageComponent {
constructor(private popoverController: PopoverController) {
}
clickMe(event: Event) {
const popover = this.popoverController.create({
component: PopoverPageToPresent,
ev: event
});
return popover.present();
}
}

View File

@ -0,0 +1,14 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { PopoverPageComponent } from './popover-page.component';
const routes: Routes = [
{ path: '', component: PopoverPageComponent }
];
@NgModule({
imports: [RouterModule.forChild(routes)],
exports: [RouterModule]
})
export class PopoverRoutingModule { }

View File

@ -0,0 +1,27 @@
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { CommonModule } from '@angular/common';
import { IonicAngularModule } from '@ionic/angular';
import { PopoverPageComponent } from './popover-page.component';
import { PopoverRoutingModule } from './popover-routing.module';
import { PopoverPageToPresent } from './popover-page-to-present';
@NgModule({
imports: [
CommonModule,
IonicAngularModule.forRoot(),
PopoverRoutingModule
],
declarations: [
PopoverPageComponent,
PopoverPageToPresent
],
providers: [
],
entryComponents: [
PopoverPageToPresent
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
})
export class PopoverModule { }