mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-16 01:52:19 +08:00
refactor(popover): get popover working with dom, react, angular components
This commit is contained in:
@ -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({
|
||||
|
@ -27,4 +27,7 @@
|
||||
<li>
|
||||
<a href='modal'>Modal Page</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href='popover'>Popover Page</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
@ -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();
|
||||
}
|
||||
|
||||
}
|
@ -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 { }
|
27
packages/demos/angular/src/app/popover/popover.module.ts
Normal file
27
packages/demos/angular/src/app/popover/popover.module.ts
Normal 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 { }
|
Reference in New Issue
Block a user