diff --git a/CHANGELOG.md b/CHANGELOG.md index 76bb75da73..c23ab302d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +## [4.4.2](https://github.com/ionic-team/ionic/compare/v4.4.1...v4.4.2) (2019-05-22) + + +### Bug Fixes + +* **angular:** account for query params and fragments within a string when navigating ([#18356](https://github.com/ionic-team/ionic/issues/18356)) ([b79f68a](https://github.com/ionic-team/ionic/commit/b79f68a)) + + + ## [4.4.1](https://github.com/ionic-team/ionic/compare/v4.4.0...v4.4.1) (2019-05-22) diff --git a/angular/package.json b/angular/package.json index f2b26b2dc7..e1e24d3ca3 100644 --- a/angular/package.json +++ b/angular/package.json @@ -1,6 +1,6 @@ { "name": "@ionic/angular", - "version": "4.4.1", + "version": "4.4.2", "description": "Angular specific wrappers for @ionic/core", "keywords": [ "ionic", @@ -45,7 +45,7 @@ "css/" ], "dependencies": { - "@ionic/core": "4.4.1", + "@ionic/core": "4.4.2", "tslib": "^1.9.3" }, "peerDependencies": { diff --git a/angular/src/providers/nav-controller.ts b/angular/src/providers/nav-controller.ts index aa74dc340d..ab69d4d89c 100644 --- a/angular/src/providers/nav-controller.ts +++ b/angular/src/providers/nav-controller.ts @@ -1,6 +1,6 @@ import { Location } from '@angular/common'; import { Injectable, Optional } from '@angular/core'; -import { NavigationExtras, NavigationStart, Router, UrlTree } from '@angular/router'; +import { NavigationExtras, NavigationStart, Router, UrlSerializer, UrlTree } from '@angular/router'; import { NavDirection, RouterDirection } from '@ionic/core'; import { IonRouterOutlet } from '../directives/navigation/ion-router-outlet'; @@ -29,6 +29,7 @@ export class NavController { constructor( platform: Platform, private location: Location, + private serializer: UrlSerializer, @Optional() private router?: Router, ) { // Subscribe to router events to detect direction @@ -190,13 +191,18 @@ export class NavController { * would change the url, so things like queryParams * would be ignored unless we create a url tree * More Info: https://github.com/angular/angular/issues/18798 - * - * Additionally, the router does some encoding under the hood, - * so make sure we are not encoding special characters more than once */ - return this.router!.navigateByUrl( - this.router!.createUrlTree([decodeURIComponent(url.toString())], options) - ); + const urlTree = this.serializer.parse(url.toString()); + + if (options.queryParams !== undefined) { + urlTree.queryParams = { ...options.queryParams }; + } + + if (options.fragment !== undefined) { + urlTree.fragment = options.fragment; + } + + return this.router!.navigateByUrl(urlTree); } } } diff --git a/core/README.md b/core/README.md index 2474656a0f..be7f328f5f 100644 --- a/core/README.md +++ b/core/README.md @@ -23,8 +23,8 @@ The Ionic Core package contains the Web Components that make up the reusable UI Easiest way to start using Ionic Core is by adding a script tag to the CDN: ```html - - + + ``` Any Ionic component added to the webpage will automatically load. This includes writing the component tag directly in HTML, or using JavaScript such as `document.createElement('ion-toggle')`. diff --git a/core/package.json b/core/package.json index 682253d1ed..3d921ca7dd 100644 --- a/core/package.json +++ b/core/package.json @@ -1,6 +1,6 @@ { "name": "@ionic/core", - "version": "4.4.1", + "version": "4.4.2", "description": "Base components for Ionic", "keywords": [ "ionic", diff --git a/docs/package.json b/docs/package.json index dfaf0000ed..a4577227da 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,6 +1,6 @@ { "name": "@ionic/docs", - "version": "4.4.1", + "version": "4.4.2", "description": "Pre-packaged API documentation for the Ionic docs.", "main": "core.json", "files": [