Skip to content

Commit 5cdfa1a

Browse files
merge release-8.2.0 (#29534)
Release 8.2.0
2 parents 665a24d + 9bfbd98 commit 5cdfa1a

File tree

36 files changed

+243
-117
lines changed

36 files changed

+243
-117
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [8.2.0](https://github.com/ionic-team/ionic-framework/compare/v8.1.3...v8.2.0) (2024-05-22)
7+
8+
9+
### Features
10+
11+
* **angular:** setting props on a signal works ([#29453](https://github.com/ionic-team/ionic-framework/issues/29453)) ([4640e04](https://github.com/ionic-team/ionic-framework/commit/4640e046ebbd35bf92737368c6262f79a8803a59)), closes [#28876](https://github.com/ionic-team/ionic-framework/issues/28876)
12+
13+
14+
15+
16+
617
## [8.1.3](https://github.com/ionic-team/ionic-framework/compare/v8.1.2...v8.1.3) (2024-05-22)
718

819

core/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [8.2.0](https://github.com/ionic-team/ionic-framework/compare/v8.1.3...v8.2.0) (2024-05-22)
7+
8+
**Note:** Version bump only for package @ionic/core
9+
10+
11+
12+
13+
614
## [8.1.3](https://github.com/ionic-team/ionic-framework/compare/v8.1.2...v8.1.3) (2024-05-22)
715

816

core/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ionic/core",
3-
"version": "8.1.3",
3+
"version": "8.2.0",
44
"description": "Base components for Ionic",
55
"keywords": [
66
"ionic",

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
"core",
44
"packages/*"
55
],
6-
"version": "8.1.3"
6+
"version": "8.2.0"
77
}

packages/angular-server/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [8.2.0](https://github.com/ionic-team/ionic-framework/compare/v8.1.3...v8.2.0) (2024-05-22)
7+
8+
**Note:** Version bump only for package @ionic/angular-server
9+
10+
11+
12+
13+
614
## [8.1.3](https://github.com/ionic-team/ionic-framework/compare/v8.1.2...v8.1.3) (2024-05-22)
715

816
**Note:** Version bump only for package @ionic/angular-server

packages/angular-server/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/angular-server/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ionic/angular-server",
3-
"version": "8.1.3",
3+
"version": "8.2.0",
44
"description": "Angular SSR Module for Ionic",
55
"keywords": [
66
"ionic",
@@ -62,6 +62,6 @@
6262
},
6363
"prettier": "@ionic/prettier-config",
6464
"dependencies": {
65-
"@ionic/core": "^8.1.3"
65+
"@ionic/core": "^8.2.0"
6666
}
6767
}

packages/angular/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@
33
All notable changes to this project will be documented in this file.
44
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
55

6+
# [8.2.0](https://github.com/ionic-team/ionic-framework/compare/v8.1.3...v8.2.0) (2024-05-22)
7+
8+
9+
### Features
10+
11+
* **angular:** setting props on a signal works ([#29453](https://github.com/ionic-team/ionic-framework/issues/29453)) ([4640e04](https://github.com/ionic-team/ionic-framework/commit/4640e046ebbd35bf92737368c6262f79a8803a59)), closes [#28876](https://github.com/ionic-team/ionic-framework/issues/28876)
12+
13+
14+
15+
16+
617
## [8.1.3](https://github.com/ionic-team/ionic-framework/compare/v8.1.2...v8.1.3) (2024-05-22)
718

819
**Note:** Version bump only for package @ionic/angular

packages/angular/common/src/directives/navigation/nav-params.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,11 @@
1919
* ```
2020
*/
2121
export class NavParams {
22-
constructor(public data: { [key: string]: any } = {}) {}
22+
constructor(public data: { [key: string]: any } = {}) {
23+
console.warn(
24+
`[Ionic Warning]: NavParams has been deprecated in favor of using Angular's input API. Developers should migrate to either the @Input decorator or the Signals-based input API.`
25+
);
26+
}
2327

2428
/**
2529
* Get the value of a nav-parameter for the current view

packages/angular/common/src/providers/angular-delegate.ts

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,15 @@ import {
2020

2121
import { NavParams } from '../directives/navigation/nav-params';
2222

23+
import { ConfigToken } from './config';
24+
2325
// TODO(FW-2827): types
2426

2527
@Injectable()
2628
export class AngularDelegate {
2729
private zone = inject(NgZone);
2830
private applicationRef = inject(ApplicationRef);
31+
private config = inject(ConfigToken);
2932

3033
create(
3134
environmentInjector: EnvironmentInjector,
@@ -37,7 +40,8 @@ export class AngularDelegate {
3740
injector,
3841
this.applicationRef,
3942
this.zone,
40-
elementReferenceKey
43+
elementReferenceKey,
44+
this.config.useSetInputAPI ?? false
4145
);
4246
}
4347
}
@@ -51,7 +55,8 @@ export class AngularFrameworkDelegate implements FrameworkDelegate {
5155
private injector: Injector,
5256
private applicationRef: ApplicationRef,
5357
private zone: NgZone,
54-
private elementReferenceKey?: string
58+
private elementReferenceKey?: string,
59+
private enableSignalsSupport?: boolean
5560
) {}
5661

5762
attachViewToDom(container: any, component: any, params?: any, cssClasses?: string[]): Promise<any> {
@@ -84,7 +89,8 @@ export class AngularFrameworkDelegate implements FrameworkDelegate {
8489
component,
8590
componentProps,
8691
cssClasses,
87-
this.elementReferenceKey
92+
this.elementReferenceKey,
93+
this.enableSignalsSupport
8894
);
8995
resolve(el);
9096
});
@@ -121,7 +127,8 @@ export const attachView = (
121127
component: any,
122128
params: any,
123129
cssClasses: string[] | undefined,
124-
elementReferenceKey: string | undefined
130+
elementReferenceKey: string | undefined,
131+
enableSignalsSupport: boolean | undefined
125132
): any => {
126133
/**
127134
* Wraps the injector with a custom injector that
@@ -164,7 +171,38 @@ export const attachView = (
164171
);
165172
}
166173

167-
Object.assign(instance, params);
174+
/**
175+
* Angular 14.1 added support for setInput
176+
* so we need to fall back to Object.assign
177+
* for Angular 14.0.
178+
*/
179+
if (enableSignalsSupport === true && componentRef.setInput !== undefined) {
180+
const { modal, popover, ...otherParams } = params;
181+
/**
182+
* Any key/value pairs set in componentProps
183+
* must be set as inputs on the component instance.
184+
*/
185+
for (const key in otherParams) {
186+
componentRef.setInput(key, otherParams[key]);
187+
}
188+
189+
/**
190+
* Using setInput will cause an error when
191+
* setting modal/popover on a component that
192+
* does not define them as an input. For backwards
193+
* compatibility purposes we fall back to using
194+
* Object.assign for these properties.
195+
*/
196+
if (modal !== undefined) {
197+
Object.assign(instance, { modal });
198+
}
199+
200+
if (popover !== undefined) {
201+
Object.assign(instance, { popover });
202+
}
203+
} else {
204+
Object.assign(instance, params);
205+
}
168206
}
169207
if (cssClasses) {
170208
for (const cssClass of cssClasses) {

packages/angular/package-lock.json

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/angular/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@ionic/angular",
3-
"version": "8.1.3",
3+
"version": "8.2.0",
44
"description": "Angular specific wrappers for @ionic/core",
55
"keywords": [
66
"ionic",
@@ -47,7 +47,7 @@
4747
}
4848
},
4949
"dependencies": {
50-
"@ionic/core": "^8.1.3",
50+
"@ionic/core": "^8.2.0",
5151
"ionicons": "^7.0.0",
5252
"jsonc-parser": "^3.0.0",
5353
"tslib": "^2.3.0"

packages/angular/src/ionic-module.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,18 @@ const DECLARATIONS = [
5252
IonMaxValidator,
5353
];
5454

55+
type OptInAngularFeatures = {
56+
useSetInputAPI?: boolean;
57+
};
58+
5559
@NgModule({
5660
declarations: DECLARATIONS,
5761
exports: DECLARATIONS,
58-
providers: [AngularDelegate, ModalController, PopoverController],
62+
providers: [ModalController, PopoverController],
5963
imports: [CommonModule],
6064
})
6165
export class IonicModule {
62-
static forRoot(config?: IonicConfig): ModuleWithProviders<IonicModule> {
66+
static forRoot(config: IonicConfig & OptInAngularFeatures = {}): ModuleWithProviders<IonicModule> {
6367
return {
6468
ngModule: IonicModule,
6569
providers: [
@@ -73,6 +77,7 @@ export class IonicModule {
7377
multi: true,
7478
deps: [ConfigToken, DOCUMENT, NgZone],
7579
},
80+
AngularDelegate,
7681
provideComponentInputBinding(),
7782
],
7883
};

packages/angular/standalone/src/providers/ionic-angular.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@ import type { IonicConfig } from '@ionic/core/components';
88
import { ModalController } from './modal-controller';
99
import { PopoverController } from './popover-controller';
1010

11-
export const provideIonicAngular = (config?: IonicConfig): EnvironmentProviders => {
11+
type OptInAngularFeatures = {
12+
useSetInputAPI?: boolean;
13+
};
14+
15+
export const provideIonicAngular = (config: IonicConfig & OptInAngularFeatures = {}): EnvironmentProviders => {
1216
return makeEnvironmentProviders([
1317
{
1418
provide: ConfigToken,

packages/angular/test/apps/ng16/src/app/lazy/version-test/modal-nav-params/nav-root.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { JsonPipe } from "@angular/common";
2-
import { Component } from "@angular/core";
2+
import { Component, Input } from "@angular/core";
33

44
import { IonicModule } from "@ionic/angular";
55

@@ -23,7 +23,7 @@ let rootParamsException = false;
2323
})
2424
export class NavRootComponent {
2525

26-
params: any;
26+
@Input() params: any = {};
2727

2828
ngOnInit() {
2929
if (this.params === undefined) {

0 commit comments

Comments
 (0)