Skip to content

Commit

Permalink
chore: update test app
Browse files Browse the repository at this point in the history
  • Loading branch information
liamdebeasi committed Jan 25, 2024
1 parent 729529f commit 96a5433
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component, NgZone } from '@angular/core';
import { AlertController } from '@ionic/angular';
import { NavComponent } from '../nav/nav.component';

@Component({
selector: 'app-alert',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<ion-content class="ion-padding">
<h1>Value</h1>
<h2>{{value}}</h2>
<h3>{{valueFromParams}}</h3>
<h3>{{prop}}</h3>
<p>modal is defined: <span id="modalInstance">{{ !!modal }}</span></p>
<p>ngOnInit: <span id="ngOnInit">{{onInit}}</span></p>
<p>ionViewWillEnter: <span id="ionViewWillEnter">{{willEnter}}</span></p>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Component, Input, NgZone, OnInit, Optional } from '@angular/core';
import { UntypedFormControl, UntypedFormGroup } from '@angular/forms';
import { ModalController, NavParams, IonNav, ViewWillLeave, ViewDidEnter, ViewDidLeave } from '@ionic/angular';
import { ModalController, IonNav, ViewWillLeave, ViewDidEnter, ViewDidLeave } from '@ionic/angular';

@Component({
selector: 'app-modal-example',
Expand All @@ -9,12 +9,12 @@ import { ModalController, NavParams, IonNav, ViewWillLeave, ViewDidEnter, ViewDi
export class ModalExampleComponent implements OnInit, ViewWillLeave, ViewDidEnter, ViewWillLeave, ViewDidLeave {

@Input() value?: string;
@Input() prop?: string;

form = new UntypedFormGroup({
select: new UntypedFormControl([])
});

valueFromParams: string;
onInit = 0;
willEnter = 0;
didEnter = 0;
Expand All @@ -25,11 +25,8 @@ export class ModalExampleComponent implements OnInit, ViewWillLeave, ViewDidEnte

constructor(
private modalCtrl: ModalController,
@Optional() public nav: IonNav,
navParams: NavParams
) {
this.valueFromParams = navParams.get('prop');
}
@Optional() public nav: IonNav
) {}

ngOnInit() {
NgZone.assertInAngularZone();
Expand Down
13 changes: 7 additions & 6 deletions packages/angular/test/base/src/app/lazy/nav/nav.component.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
import { ModalExampleComponent } from '../modal-example/modal-example.component';
import { NavParams } from '@ionic/angular';

@Component({
selector: 'app-nav',
Expand All @@ -10,11 +9,13 @@ export class NavComponent {
rootPage = ModalExampleComponent;
rootParams: any;

constructor(
params: NavParams
) {
@Input() value?: string;
@Input() prop?: string;

ngOnInit() {
this.rootParams = {
...params.data
value: this.value,
prop: this.prop
};
}
}

0 comments on commit 96a5433

Please sign in to comment.