1e41f4b71Sopenharmony_ci# @ohos.atomicservice.NavPushPathHelper (Subpackage Routing Utility Class)
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ciOn the initial launch, the atomic service only downloads and installs the main package and its dependencies. Therefore, if the [NavDestination](ts-basic-components-navdestination.md) resides in a different HSP subpackage that is not a dependency of the main package, you'll need to use **NavPushPathHelper** to download and install the corresponding HSP subpackage first. After that, push the specified **NavDestination** page information onto the stack. This way, you enable [Navigation](ts-basic-components-navigation.md) to support dynamic loading of the HSP subpackage before the navigation occurs.
4e41f4b71Sopenharmony_ci
5e41f4b71Sopenharmony_ci> **NOTE**
6e41f4b71Sopenharmony_ci>
7e41f4b71Sopenharmony_ci> This component is supported since API version 12. Updates will be marked with a superscript to indicate their earliest API version.
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci## Modules to Import
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ci```ts
12e41f4b71Sopenharmony_ciimport { NavPushPathHelper } from '@kit.ArkUI'
13e41f4b71Sopenharmony_ci```
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ci## Child Components
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ciNot supported
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ci## Attributes
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ciThe [universal attributes](ts-universal-attributes-size.md) are not supported.
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci## NavPushPathHelper
24e41f4b71Sopenharmony_ci
25e41f4b71Sopenharmony_ciEncapsulates all navigation APIs for [NavPathStack](ts-basic-components-navigation.md#navpathstack10). **NavPushPathHelper** holds a **NavPathStack** object and checks for the existence of a subpackage within its encapsulated navigation APIs. If the subpackage is absent, it dynamically downloads the subpackage. Once the download is complete, it calls the appropriate API of **NavPathStack** to push the specified [NavDestination](ts-basic-components-navdestination.md) page onto the stack. For details, see [Example](#example).
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci### constructor
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ciconstructor(navPathStack: NavPathStack): void
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ciA constructor used to create a **NavPushPathHelper** object.
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Parameters**
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
40e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
41e41f4b71Sopenharmony_ci| navPathStack | [NavPathStack](ts-basic-components-navigation.md#navpathstack10) | Yes   | [Navigation](ts-basic-components-navigation.md) stack.|
42e41f4b71Sopenharmony_ci
43e41f4b71Sopenharmony_ci### pushPath
44e41f4b71Sopenharmony_ci
45e41f4b71Sopenharmony_cipushPath(moduleName: string, info: NavPathInfo, animated?: boolean): Promise\<void\>
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **info**, onto the navigation stack. This API uses a promise to return the result.
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**Parameters**
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
56e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
57e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
58e41f4b71Sopenharmony_ci| info | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes   | Information about the [NavDestination](ts-basic-components-navdestination.md) page.|
59e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
60e41f4b71Sopenharmony_ci
61e41f4b71Sopenharmony_ci**Return value**
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci| Type               | Description       |
64e41f4b71Sopenharmony_ci| ------------------- | --------- |
65e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
66e41f4b71Sopenharmony_ci
67e41f4b71Sopenharmony_ci**Error codes**
68e41f4b71Sopenharmony_ci
69e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
70e41f4b71Sopenharmony_ci
71e41f4b71Sopenharmony_ci| ID  | Error Message|
72e41f4b71Sopenharmony_ci| --------- | ------- |
73e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
74e41f4b71Sopenharmony_ci
75e41f4b71Sopenharmony_ci### pushPath
76e41f4b71Sopenharmony_ci
77e41f4b71Sopenharmony_cipushPath(moduleName: string, info: NavPathInfo, options?: NavigationOptions): Promise\<void\>
78e41f4b71Sopenharmony_ci
79e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **info**, onto the navigation stack. This API uses a promise to return the result. The behavior can vary based on [LaunchMode](ts-basic-components-navigation.md#launchmode12) specified in the **options** parameter.
80e41f4b71Sopenharmony_ci
81e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci**Parameters**
86e41f4b71Sopenharmony_ci
87e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
88e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
89e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
90e41f4b71Sopenharmony_ci| info | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes   | Information about the [NavDestination](ts-basic-components-navdestination.md) page.|
91e41f4b71Sopenharmony_ci| options | [NavigationOptions](ts-basic-components-navigation.md#navigationoptions12) | No   | Navigation options.|
92e41f4b71Sopenharmony_ci
93e41f4b71Sopenharmony_ci**Return value**
94e41f4b71Sopenharmony_ci
95e41f4b71Sopenharmony_ci| Type               | Description       |
96e41f4b71Sopenharmony_ci| ------------------- | --------- |
97e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
98e41f4b71Sopenharmony_ci
99e41f4b71Sopenharmony_ci**Error codes**
100e41f4b71Sopenharmony_ci
101e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci| ID  | Error Message|
104e41f4b71Sopenharmony_ci| --------- | ------- |
105e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
106e41f4b71Sopenharmony_ci
107e41f4b71Sopenharmony_ci### pushPathByName
108e41f4b71Sopenharmony_ci
109e41f4b71Sopenharmony_cipushPathByName(moduleName: string, name: string, param: unknown, animated?: boolean): Promise\<void\>
110e41f4b71Sopenharmony_ci
111e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **name**, onto the navigation stack, along with the data specified by **param**. This API uses a promise to return the result.
112e41f4b71Sopenharmony_ci
113e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
114e41f4b71Sopenharmony_ci
115e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
116e41f4b71Sopenharmony_ci
117e41f4b71Sopenharmony_ci**Parameters**
118e41f4b71Sopenharmony_ci
119e41f4b71Sopenharmony_ci| Name   | Type     | Mandatory  | Description                   |
120e41f4b71Sopenharmony_ci| ----- | ------- | ---- | --------------------- |
121e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
122e41f4b71Sopenharmony_ci| name  | string  | Yes   | Name of the [NavDestination](ts-basic-components-navdestination.md) page.  |
123e41f4b71Sopenharmony_ci| param | unknown | Yes   | Settings of the [NavDestination](ts-basic-components-navdestination.md) page.|
124e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ci**Return value**
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci| Type               | Description       |
129e41f4b71Sopenharmony_ci| ------------------- | --------- |
130e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ci**Error codes**
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ci| ID  | Error Message|
137e41f4b71Sopenharmony_ci| --------- | ------- |
138e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ci### pushPathByName
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_cipushPathByName(moduleName: string, name: string, param: Object, onPop: Callback\<PopInfo>, animated?: boolean): Promise\<void\>
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **name**, onto the navigation stack, along with the data specified by **param**. The **onPop** callback handles the return results when the page is popped from the stack.This API uses a promise to return the result.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ci**Parameters**
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci| Name| Type| Mandatory| Description|
153e41f4b71Sopenharmony_ci|------|------|------|------|
154e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
155e41f4b71Sopenharmony_ci| name  | string  | Yes   | Name of the [NavDestination](ts-basic-components-navdestination.md) page.  |
156e41f4b71Sopenharmony_ci| param | Object | Yes   | Settings of the [NavDestination](ts-basic-components-navdestination.md) page.|
157e41f4b71Sopenharmony_ci| onPop | Callback\<[PopInfo](ts-basic-components-navigation.md#popinfo11)> | Yes| Callback used to receive the result.|
158e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
159e41f4b71Sopenharmony_ci
160e41f4b71Sopenharmony_ci**Return value**
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci| Type               | Description       |
163e41f4b71Sopenharmony_ci| ------------------- | --------- |
164e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci**Error codes**
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ci| ID  | Error Message|
171e41f4b71Sopenharmony_ci| --------- | ------- |
172e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ci### pushDestination
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_cipushDestination(moduleName: string, info: NavPathInfo, animated?: boolean): Promise\<void\>
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **info**, onto the navigation stack. This API uses a promise to return the result.
179e41f4b71Sopenharmony_ci
180e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
181e41f4b71Sopenharmony_ci
182e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
183e41f4b71Sopenharmony_ci
184e41f4b71Sopenharmony_ci**Parameters**
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
187e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
188e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
189e41f4b71Sopenharmony_ci| info | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes   | Information about the [NavDestination](ts-basic-components-navdestination.md) page.|
190e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
191e41f4b71Sopenharmony_ci
192e41f4b71Sopenharmony_ci**Return value**
193e41f4b71Sopenharmony_ci
194e41f4b71Sopenharmony_ci| Type               | Description       |
195e41f4b71Sopenharmony_ci| ------------------- | --------- |
196e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
197e41f4b71Sopenharmony_ci
198e41f4b71Sopenharmony_ci**Error codes**
199e41f4b71Sopenharmony_ci
200e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md) and [Router Error Codes](../errorcode-router.md).
201e41f4b71Sopenharmony_ci
202e41f4b71Sopenharmony_ci| ID  | Error Message|
203e41f4b71Sopenharmony_ci| --------- | ------- |
204e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
205e41f4b71Sopenharmony_ci| 100001    | Internal error.|
206e41f4b71Sopenharmony_ci| 100005    | Builder function not registered. |
207e41f4b71Sopenharmony_ci| 100006    | NavDestination not found.|
208e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
209e41f4b71Sopenharmony_ci
210e41f4b71Sopenharmony_ci### pushDestination
211e41f4b71Sopenharmony_ci
212e41f4b71Sopenharmony_cipushDestination(moduleName: string, info: NavPathInfo, options?: NavigationOptions): Promise\<void\>
213e41f4b71Sopenharmony_ci
214e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **info**, onto the navigation stack. This API uses a promise to return the result. The behavior can vary based on [LaunchMode](ts-basic-components-navigation.md#launchmode12) specified in the **options** parameter.
215e41f4b71Sopenharmony_ci
216e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
217e41f4b71Sopenharmony_ci
218e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
219e41f4b71Sopenharmony_ci
220e41f4b71Sopenharmony_ci**Parameters**
221e41f4b71Sopenharmony_ci
222e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
223e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
224e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
225e41f4b71Sopenharmony_ci| info | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes   | Information about the [NavDestination](ts-basic-components-navdestination.md) page.|
226e41f4b71Sopenharmony_ci| options | [NavigationOptions](ts-basic-components-navigation.md#navigationoptions12) | No   | Navigation options.|
227e41f4b71Sopenharmony_ci
228e41f4b71Sopenharmony_ci**Return value**
229e41f4b71Sopenharmony_ci
230e41f4b71Sopenharmony_ci| Type               | Description       |
231e41f4b71Sopenharmony_ci| ------------------- | --------- |
232e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
233e41f4b71Sopenharmony_ci
234e41f4b71Sopenharmony_ci**Error codes**
235e41f4b71Sopenharmony_ci
236e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md) and [Router Error Codes](../errorcode-router.md).
237e41f4b71Sopenharmony_ci
238e41f4b71Sopenharmony_ci| ID  | Error Message|
239e41f4b71Sopenharmony_ci| --------- | ------- |
240e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
241e41f4b71Sopenharmony_ci| 100001    | Internal error.|
242e41f4b71Sopenharmony_ci| 100005    | Builder function not registered. |
243e41f4b71Sopenharmony_ci| 100006    | NavDestination not found.|
244e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
245e41f4b71Sopenharmony_ci
246e41f4b71Sopenharmony_ci### pushDestinationByName
247e41f4b71Sopenharmony_ci
248e41f4b71Sopenharmony_cipushDestinationByName(moduleName: string, name: string, param: Object, animated?: boolean): Promise\<void\>
249e41f4b71Sopenharmony_ci
250e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **name**, onto the navigation stack, along with the data specified by **param**. This API uses a promise to return the result.
251e41f4b71Sopenharmony_ci
252e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
253e41f4b71Sopenharmony_ci
254e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
255e41f4b71Sopenharmony_ci
256e41f4b71Sopenharmony_ci**Parameters**
257e41f4b71Sopenharmony_ci
258e41f4b71Sopenharmony_ci| Name   | Type     | Mandatory  | Description                   |
259e41f4b71Sopenharmony_ci| ----- | ------- | ---- | --------------------- |
260e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
261e41f4b71Sopenharmony_ci| name  | string  | Yes   | Name of the [NavDestination](ts-basic-components-navdestination.md) page.  |
262e41f4b71Sopenharmony_ci| param | Object | Yes   | Settings of the [NavDestination](ts-basic-components-navdestination.md) page.|
263e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
264e41f4b71Sopenharmony_ci
265e41f4b71Sopenharmony_ci**Return value**
266e41f4b71Sopenharmony_ci
267e41f4b71Sopenharmony_ci| Type               | Description       |
268e41f4b71Sopenharmony_ci| ------------------- | --------- |
269e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
270e41f4b71Sopenharmony_ci
271e41f4b71Sopenharmony_ci**Error codes**
272e41f4b71Sopenharmony_ci
273e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md) and [Router Error Codes](../errorcode-router.md).
274e41f4b71Sopenharmony_ci
275e41f4b71Sopenharmony_ci| ID  | Error Message|
276e41f4b71Sopenharmony_ci| --------- | ------- |
277e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
278e41f4b71Sopenharmony_ci| 100001    | Internal error.|
279e41f4b71Sopenharmony_ci| 100005    | Builder function not registered. |
280e41f4b71Sopenharmony_ci| 100006    | NavDestination not found.|
281e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
282e41f4b71Sopenharmony_ci
283e41f4b71Sopenharmony_ci### pushDestinationByName
284e41f4b71Sopenharmony_ci
285e41f4b71Sopenharmony_cipushDestinationByName(moduleName: string, name: string, param: Object, onPop: Callback\<PopInfo>, animated?: boolean): Promise\<void\>
286e41f4b71Sopenharmony_ci
287e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **name**, onto the navigation stack, along with the data specified by **param**. The **onPop** callback handles the return results when the page is popped from the stack.This API uses a promise to return the result.
288e41f4b71Sopenharmony_ci
289e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
290e41f4b71Sopenharmony_ci
291e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
292e41f4b71Sopenharmony_ci
293e41f4b71Sopenharmony_ci**Parameters**
294e41f4b71Sopenharmony_ci
295e41f4b71Sopenharmony_ci| Name   | Type     | Mandatory  | Description                   |
296e41f4b71Sopenharmony_ci| ----- | ------- | ---- | --------------------- |
297e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
298e41f4b71Sopenharmony_ci| name  | string  | Yes   | Name of the [NavDestination](ts-basic-components-navdestination.md) page.  |
299e41f4b71Sopenharmony_ci| param | Object | Yes   | Settings of the [NavDestination](ts-basic-components-navdestination.md) page.|
300e41f4b71Sopenharmony_ci| onPop | Callback\<[PopInfo](ts-basic-components-navigation.md#popinfo11)> | Yes   | Callback used to handle the result returned when the page is popped out of the stack.|
301e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
302e41f4b71Sopenharmony_ci
303e41f4b71Sopenharmony_ci**Return value**
304e41f4b71Sopenharmony_ci
305e41f4b71Sopenharmony_ci| Type               | Description       |
306e41f4b71Sopenharmony_ci| ------------------- | --------- |
307e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
308e41f4b71Sopenharmony_ci
309e41f4b71Sopenharmony_ci**Error codes**
310e41f4b71Sopenharmony_ci
311e41f4b71Sopenharmony_ciFor details about the error codes, see [Universal Error Codes](../../errorcode-universal.md) and [Router Error Codes](../errorcode-router.md).
312e41f4b71Sopenharmony_ci
313e41f4b71Sopenharmony_ci| ID  | Error Message|
314e41f4b71Sopenharmony_ci| --------- | ------- |
315e41f4b71Sopenharmony_ci| 401      | Parameter error. Possible causes: 1. Mandatory parameters are left unspecified; 2.Incorrect parameter types; 3. Parameter verification failed.   |
316e41f4b71Sopenharmony_ci| 100001    | Internal error.|
317e41f4b71Sopenharmony_ci| 100005    | Builder function not registered. |
318e41f4b71Sopenharmony_ci| 100006    | NavDestination not found.|
319e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
320e41f4b71Sopenharmony_ci
321e41f4b71Sopenharmony_ci### replacePath
322e41f4b71Sopenharmony_ci
323e41f4b71Sopenharmony_cireplacePath(moduleName: string, info: NavPathInfo, animated?: boolean): Promise\<void\>
324e41f4b71Sopenharmony_ci
325e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pops the top page from the current navigation stack and pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **info**, onto the stack. This API uses a promise to return the result.
326e41f4b71Sopenharmony_ci
327e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
328e41f4b71Sopenharmony_ci
329e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
330e41f4b71Sopenharmony_ci
331e41f4b71Sopenharmony_ci**Parameters**
332e41f4b71Sopenharmony_ci
333e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
334e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
335e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
336e41f4b71Sopenharmony_ci| info | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes   | Parameters of the page to replace the top of the navigation stack.|
337e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
338e41f4b71Sopenharmony_ci
339e41f4b71Sopenharmony_ci**Return value**
340e41f4b71Sopenharmony_ci
341e41f4b71Sopenharmony_ci| Type               | Description       |
342e41f4b71Sopenharmony_ci| ------------------- | --------- |
343e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
344e41f4b71Sopenharmony_ci
345e41f4b71Sopenharmony_ci**Error codes**
346e41f4b71Sopenharmony_ci
347e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
348e41f4b71Sopenharmony_ci
349e41f4b71Sopenharmony_ci| ID  | Error Message|
350e41f4b71Sopenharmony_ci| --------- | ------- |
351e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
352e41f4b71Sopenharmony_ci
353e41f4b71Sopenharmony_ci### replacePath
354e41f4b71Sopenharmony_ci
355e41f4b71Sopenharmony_cireplacePath(moduleName: string, info: NavPathInfo, options?: NavigationOptions): Promise\<void\>
356e41f4b71Sopenharmony_ci
357e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pops the top page from the current navigation stack and pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **info**, onto the stack. This API uses a promise to return the result. The behavior can vary based on [LaunchMode](ts-basic-components-navigation.md#launchmode12) specified in the **options** parameter.
358e41f4b71Sopenharmony_ci
359e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
360e41f4b71Sopenharmony_ci
361e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
362e41f4b71Sopenharmony_ci
363e41f4b71Sopenharmony_ci**Parameters**
364e41f4b71Sopenharmony_ci
365e41f4b71Sopenharmony_ci| Name  | Type                           | Mandatory  | Description                  |
366e41f4b71Sopenharmony_ci| ---- | ----------------------------- | ---- | -------------------- |
367e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
368e41f4b71Sopenharmony_ci| info | [NavPathInfo](ts-basic-components-navigation.md#navpathinfo10) | Yes   | Parameters of the page to replace the top of the navigation stack.|
369e41f4b71Sopenharmony_ci| options | [NavigationOptions](ts-basic-components-navigation.md#navigationoptions12) | No   | Navigation options.|
370e41f4b71Sopenharmony_ci
371e41f4b71Sopenharmony_ci**Return value**
372e41f4b71Sopenharmony_ci
373e41f4b71Sopenharmony_ci| Type               | Description       |
374e41f4b71Sopenharmony_ci| ------------------- | --------- |
375e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
376e41f4b71Sopenharmony_ci
377e41f4b71Sopenharmony_ci**Error codes**
378e41f4b71Sopenharmony_ci
379e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
380e41f4b71Sopenharmony_ci
381e41f4b71Sopenharmony_ci| ID  | Error Message|
382e41f4b71Sopenharmony_ci| --------- | ------- |
383e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
384e41f4b71Sopenharmony_ci
385e41f4b71Sopenharmony_ci### replacePathByName
386e41f4b71Sopenharmony_ci
387e41f4b71Sopenharmony_cireplacePathByName(moduleName: string, name: string, param: Object, animated?: boolean): Promise\<void\>
388e41f4b71Sopenharmony_ci
389e41f4b71Sopenharmony_ciChecks for the target subpackgae and, if it is not present, initiates a download using the specified module name. Once the subpackage is downloaded, the API pops the top page from the current navigation stack and pushes the [NavDestination](ts-basic-components-navdestination.md) page, as indicated by **name**, onto the stack. This API uses a promise to return the result.
390e41f4b71Sopenharmony_ci
391e41f4b71Sopenharmony_ci**Atomic service API**: This API can be used in atomic services since API version 12.
392e41f4b71Sopenharmony_ci
393e41f4b71Sopenharmony_ci**System capability**: SystemCapability.ArkUI.ArkUI.Full
394e41f4b71Sopenharmony_ci
395e41f4b71Sopenharmony_ci**Parameters**
396e41f4b71Sopenharmony_ci
397e41f4b71Sopenharmony_ci| Name   | Type     | Mandatory  | Description                   |
398e41f4b71Sopenharmony_ci| ----- | ------- | ---- | --------------------- |
399e41f4b71Sopenharmony_ci| moduleName | string | Yes   | Module name of the package where the [NavDestination](ts-basic-components-navdestination.md) page is located.|
400e41f4b71Sopenharmony_ci| name  | string  | Yes   | Name of the [NavDestination](ts-basic-components-navdestination.md) page.  |
401e41f4b71Sopenharmony_ci| param | Object | Yes   | Settings of the [NavDestination](ts-basic-components-navdestination.md) page.|
402e41f4b71Sopenharmony_ci| animated | boolean | No   | Whether to support transition animation.<br>Default value: **true**|
403e41f4b71Sopenharmony_ci
404e41f4b71Sopenharmony_ci**Return value**
405e41f4b71Sopenharmony_ci
406e41f4b71Sopenharmony_ci| Type               | Description       |
407e41f4b71Sopenharmony_ci| ------------------- | --------- |
408e41f4b71Sopenharmony_ci| Promise\<void\> | Promise used to return the result.|
409e41f4b71Sopenharmony_ci
410e41f4b71Sopenharmony_ci**Error codes**
411e41f4b71Sopenharmony_ci
412e41f4b71Sopenharmony_ciFor details about the error codes, see [Router Error Codes](../errorcode-router.md).
413e41f4b71Sopenharmony_ci
414e41f4b71Sopenharmony_ci| ID  | Error Message|
415e41f4b71Sopenharmony_ci| --------- | ------- |
416e41f4b71Sopenharmony_ci| 300001    | hsp silent install fail.|
417e41f4b71Sopenharmony_ci
418e41f4b71Sopenharmony_ci## Events
419e41f4b71Sopenharmony_ci
420e41f4b71Sopenharmony_ciThe [universal events](ts-universal-events-click.md) are not supported.
421e41f4b71Sopenharmony_ci
422e41f4b71Sopenharmony_ci## Example
423e41f4b71Sopenharmony_ci
424e41f4b71Sopenharmony_ciMain package:
425e41f4b71Sopenharmony_ci```ts
426e41f4b71Sopenharmony_ci// Index.ets
427e41f4b71Sopenharmony_ciimport { NavPushPathHelper } from '@kit.ArkUI'
428e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
429e41f4b71Sopenharmony_ci@Entry
430e41f4b71Sopenharmony_ci@Component
431e41f4b71Sopenharmony_cistruct NavigationExample {
432e41f4b71Sopenharmony_ci  pageInfo: NavPathStack = new NavPathStack()
433e41f4b71Sopenharmony_ci  helper: NavPushPathHelper = new NavPushPathHelper(this.pageInfo)
434e41f4b71Sopenharmony_ci
435e41f4b71Sopenharmony_ci  build() {
436e41f4b71Sopenharmony_ci    Navigation(this.pageInfo) {
437e41f4b71Sopenharmony_ci      Column() {
438e41f4b71Sopenharmony_ci        Button('StartTest', { stateEffect: true, type: ButtonType.Capsule })
439e41f4b71Sopenharmony_ci          .width('80%')
440e41f4b71Sopenharmony_ci          .height(40)
441e41f4b71Sopenharmony_ci          .margin(20)
442e41f4b71Sopenharmony_ci          .onClick(() => {
443e41f4b71Sopenharmony_ci            this.helper.pushPath('hsptest1', { name: 'pageOne' }, false)
444e41f4b71Sopenharmony_ci              .catch((error: BusinessError) => {
445e41f4b71Sopenharmony_ci              console.error(`[pushPath]failed, error code = ${error.code}, error.message = ${error.message}.`);
446e41f4b71Sopenharmony_ci            }).then(() => {
447e41f4b71Sopenharmony_ci              console.error('[pushPath]success.');
448e41f4b71Sopenharmony_ci            }); // Push the NavDestination page specified by name to the navigation stack.
449e41f4b71Sopenharmony_ci          })
450e41f4b71Sopenharmony_ci      }
451e41f4b71Sopenharmony_ci    }.title('NavIndex')
452e41f4b71Sopenharmony_ci  }
453e41f4b71Sopenharmony_ci}
454e41f4b71Sopenharmony_ci```
455e41f4b71Sopenharmony_ciSubpackage **hsptest1**:
456e41f4b71Sopenharmony_ci```ts
457e41f4b71Sopenharmony_ci// PageOne.ets
458e41f4b71Sopenharmony_ciimport { NavPushPathHelper } from '@kit.ArkUI'
459e41f4b71Sopenharmony_ciimport { BusinessError } from '@kit.BasicServicesKit';
460e41f4b71Sopenharmony_ci
461e41f4b71Sopenharmony_ciclass TmpClass {
462e41f4b71Sopenharmony_ci  count: number = 10
463e41f4b71Sopenharmony_ci}
464e41f4b71Sopenharmony_ci
465e41f4b71Sopenharmony_ciclass ParamWithOp {
466e41f4b71Sopenharmony_ci  operation: number = 1
467e41f4b71Sopenharmony_ci  count: number = 10
468e41f4b71Sopenharmony_ci}
469e41f4b71Sopenharmony_ci
470e41f4b71Sopenharmony_ci@Builder
471e41f4b71Sopenharmony_ciexport function PageOneBuilder(name: string, param: Object) {
472e41f4b71Sopenharmony_ci  PageOne()
473e41f4b71Sopenharmony_ci}
474e41f4b71Sopenharmony_ci
475e41f4b71Sopenharmony_ci@Component
476e41f4b71Sopenharmony_ciexport struct PageOne {
477e41f4b71Sopenharmony_ci  pageInfo: NavPathStack = new NavPathStack();
478e41f4b71Sopenharmony_ci  helper: NavPushPathHelper = new NavPushPathHelper(this.pageInfo)
479e41f4b71Sopenharmony_ci  @State message: string = 'Hello World'
480e41f4b71Sopenharmony_ci
481e41f4b71Sopenharmony_ci  build() {
482e41f4b71Sopenharmony_ci    NavDestination() {
483e41f4b71Sopenharmony_ci      Column() {
484e41f4b71Sopenharmony_ci        Text(this.message)
485e41f4b71Sopenharmony_ci          .width('80%')
486e41f4b71Sopenharmony_ci          .height(50)
487e41f4b71Sopenharmony_ci          .margin(10)
488e41f4b71Sopenharmony_ci
489e41f4b71Sopenharmony_ci        Button('pushPath', { stateEffect: true, type: ButtonType.Capsule })
490e41f4b71Sopenharmony_ci          .width('80%')
491e41f4b71Sopenharmony_ci          .height(35)
492e41f4b71Sopenharmony_ci          .margin(10)
493e41f4b71Sopenharmony_ci          .onClick(() => {
494e41f4b71Sopenharmony_ci            this.helper.pushPath('hsptest2', { name: 'pageTwo', param: new ParamWithOp(), onPop: (popInfo: PopInfo) => {
495e41f4b71Sopenharmony_ci              this.message = '[pushPath]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
496e41f4b71Sopenharmony_ci            }}).catch((error: BusinessError) => {
497e41f4b71Sopenharmony_ci              console.error(`[pushPath]failed, error code = ${error.code}, error.message = ${error.message}.`);
498e41f4b71Sopenharmony_ci            }).then(() => {
499e41f4b71Sopenharmony_ci              console.log('[pushPath]success.');
500e41f4b71Sopenharmony_ci            });
501e41f4b71Sopenharmony_ci          })
502e41f4b71Sopenharmony_ci
503e41f4b71Sopenharmony_ci        Button('pushPath with NavigationOptions', { stateEffect: true, type: ButtonType.Capsule })
504e41f4b71Sopenharmony_ci          .width('80%')
505e41f4b71Sopenharmony_ci          .height(35)
506e41f4b71Sopenharmony_ci          .margin(10)
507e41f4b71Sopenharmony_ci          .onClick(() => {
508e41f4b71Sopenharmony_ci            this.helper.pushPath('hsptest2', { name: 'pageTwo', param: new ParamWithOp(), onPop: (popInfo: PopInfo) => {
509e41f4b71Sopenharmony_ci              this.message = '[pushPath with NavigationOptions]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
510e41f4b71Sopenharmony_ci            }}, {launchMode:0, animated:true}).catch((error: BusinessError) => {
511e41f4b71Sopenharmony_ci              console.error(`[pushPath with NavigationOptions]failed, error code = ${error.code}, error.message = ${error.message}.`);
512e41f4b71Sopenharmony_ci            }).then(() => {
513e41f4b71Sopenharmony_ci              console.log('[pushPath with NavigationOptions]success.');
514e41f4b71Sopenharmony_ci            });
515e41f4b71Sopenharmony_ci          })
516e41f4b71Sopenharmony_ci
517e41f4b71Sopenharmony_ci        Button('pushPathByName', { stateEffect: true, type: ButtonType.Capsule })
518e41f4b71Sopenharmony_ci          .width('80%')
519e41f4b71Sopenharmony_ci          .height(35)
520e41f4b71Sopenharmony_ci          .margin(10)
521e41f4b71Sopenharmony_ci          .onClick(() => {
522e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
523e41f4b71Sopenharmony_ci            this.helper.pushPathByName('hsptest2', 'pageTwo', tmp, (popInfo) => {
524e41f4b71Sopenharmony_ci              this.message = '[pushPathByName]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
525e41f4b71Sopenharmony_ci            }).catch((error: BusinessError) => {
526e41f4b71Sopenharmony_ci              console.error(`[pushPathByName]failed, error code = ${error.code}, error.message = ${error.message}.`);
527e41f4b71Sopenharmony_ci            }).then(() => {
528e41f4b71Sopenharmony_ci              console.log('[pushPathByName]success.');
529e41f4b71Sopenharmony_ci            });
530e41f4b71Sopenharmony_ci          })
531e41f4b71Sopenharmony_ci
532e41f4b71Sopenharmony_ci        Button('pushPathByNameWithoutOnPop', { stateEffect: true, type: ButtonType.Capsule })
533e41f4b71Sopenharmony_ci          .width('80%')
534e41f4b71Sopenharmony_ci          .height(35)
535e41f4b71Sopenharmony_ci          .margin(10)
536e41f4b71Sopenharmony_ci          .onClick(() => {
537e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
538e41f4b71Sopenharmony_ci            this.helper.pushPathByName('hsptest2', 'pageTwo', tmp, true)
539e41f4b71Sopenharmony_ci            .catch((error: BusinessError) => {
540e41f4b71Sopenharmony_ci              console.error(`[pushPathByNameWithoutOnPop]failed, error code = ${error.code}, error.message = ${error.message}.`);
541e41f4b71Sopenharmony_ci            }).then(() => {
542e41f4b71Sopenharmony_ci              console.log('[pushPathByNameWithoutOnPop]success.');
543e41f4b71Sopenharmony_ci            });
544e41f4b71Sopenharmony_ci          })
545e41f4b71Sopenharmony_ci
546e41f4b71Sopenharmony_ci        Button('pushDestination', { stateEffect: true, type: ButtonType.Capsule })
547e41f4b71Sopenharmony_ci          .width('80%')
548e41f4b71Sopenharmony_ci          .height(35)
549e41f4b71Sopenharmony_ci          .margin(10)
550e41f4b71Sopenharmony_ci          .onClick(() => {
551e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
552e41f4b71Sopenharmony_ci            this.helper.pushDestination('hsptest2', { name: 'pageTwo', param: new ParamWithOp(), onPop: (popInfo: PopInfo) => {
553e41f4b71Sopenharmony_ci              this.message = '[pushDestination]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
554e41f4b71Sopenharmony_ci            }}).catch((error: BusinessError) => {
555e41f4b71Sopenharmony_ci              console.error(`[pushDestination]failed, error code = ${error.code}, error.message = ${error.message}.`);
556e41f4b71Sopenharmony_ci            }).then(() => {
557e41f4b71Sopenharmony_ci              console.error('[pushDestination]success.');
558e41f4b71Sopenharmony_ci            });
559e41f4b71Sopenharmony_ci          })
560e41f4b71Sopenharmony_ci
561e41f4b71Sopenharmony_ci        Button('pushDestination with NavigationOptions', { stateEffect: true, type: ButtonType.Capsule })
562e41f4b71Sopenharmony_ci          .width('80%')
563e41f4b71Sopenharmony_ci          .height(35)
564e41f4b71Sopenharmony_ci          .margin(10)
565e41f4b71Sopenharmony_ci          .onClick(() => {
566e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
567e41f4b71Sopenharmony_ci            this.helper.pushDestination('hsptest2', { name: 'pageTwo', param: new ParamWithOp(), onPop: (popInfo: PopInfo) => {
568e41f4b71Sopenharmony_ci              this.message = '[pushDestination with NavigationOptions]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
569e41f4b71Sopenharmony_ci            }}, {launchMode:0, animated:true}).catch((error: BusinessError) => {
570e41f4b71Sopenharmony_ci              console.error(`[pushDestination with NavigationOptions]failed, error code = ${error.code}, error.message = ${error.message}.`);
571e41f4b71Sopenharmony_ci            }).then(() => {
572e41f4b71Sopenharmony_ci              console.error('[pushDestination with NavigationOptions]success.');
573e41f4b71Sopenharmony_ci            });
574e41f4b71Sopenharmony_ci          })
575e41f4b71Sopenharmony_ci
576e41f4b71Sopenharmony_ci        Button('pushDestinationByName', { stateEffect: true, type: ButtonType.Capsule })
577e41f4b71Sopenharmony_ci          .width('80%')
578e41f4b71Sopenharmony_ci          .height(35)
579e41f4b71Sopenharmony_ci          .margin(10)
580e41f4b71Sopenharmony_ci          .onClick(() => {
581e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
582e41f4b71Sopenharmony_ci            this.helper.pushDestinationByName('hsptest2','pageTwo', tmp, (popInfo) => {
583e41f4b71Sopenharmony_ci              this.message = '[pushDestinationByName]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
584e41f4b71Sopenharmony_ci            }).catch((error: BusinessError) => {
585e41f4b71Sopenharmony_ci              console.error(`[pushDestinationByName]failed, error code = ${error.code}, error.message = ${error.message}.`);
586e41f4b71Sopenharmony_ci            }).then(() => {
587e41f4b71Sopenharmony_ci              console.error('[pushDestinationByName]success.');
588e41f4b71Sopenharmony_ci            });
589e41f4b71Sopenharmony_ci          })
590e41f4b71Sopenharmony_ci
591e41f4b71Sopenharmony_ci        Button('pushDestinationByNameWithoutOnPop', { stateEffect: true, type: ButtonType.Capsule })
592e41f4b71Sopenharmony_ci          .width('80%')
593e41f4b71Sopenharmony_ci          .height(35)
594e41f4b71Sopenharmony_ci          .margin(10)
595e41f4b71Sopenharmony_ci          .onClick(() => {
596e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
597e41f4b71Sopenharmony_ci            this.helper.pushDestinationByName('hsptest2','pageTwo', tmp, true)
598e41f4b71Sopenharmony_ci              .catch((error: BusinessError) => {
599e41f4b71Sopenharmony_ci                console.error(`[pushDestinationByNameWithoutOnPop]failed, error code = ${error.code}, error.message = ${error.message}.`);
600e41f4b71Sopenharmony_ci              }).then(() => {
601e41f4b71Sopenharmony_ci              console.error('[pushDestinationByNameWithoutOnPop]success.');
602e41f4b71Sopenharmony_ci            });
603e41f4b71Sopenharmony_ci          })
604e41f4b71Sopenharmony_ci
605e41f4b71Sopenharmony_ci        Button('replacePath', { stateEffect: true, type: ButtonType.Capsule })
606e41f4b71Sopenharmony_ci          .width('80%')
607e41f4b71Sopenharmony_ci          .height(35)
608e41f4b71Sopenharmony_ci          .margin(10)
609e41f4b71Sopenharmony_ci          .onClick(() => {
610e41f4b71Sopenharmony_ci            this.helper.replacePath('hsptest2', { name: 'pageTwo', param: new ParamWithOp(), onPop: (popInfo: PopInfo) => {
611e41f4b71Sopenharmony_ci              this.message = '[replacePath]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
612e41f4b71Sopenharmony_ci            }}).catch((error: BusinessError) => {
613e41f4b71Sopenharmony_ci              console.error(`[replacePath]failed, error code = ${error.code}, error.message = ${error.message}.`);
614e41f4b71Sopenharmony_ci            }).then(() => {
615e41f4b71Sopenharmony_ci              console.log('[replacePath]success.');
616e41f4b71Sopenharmony_ci            });
617e41f4b71Sopenharmony_ci          })
618e41f4b71Sopenharmony_ci
619e41f4b71Sopenharmony_ci        Button('replacePath with NavigationOptions', { stateEffect: true, type: ButtonType.Capsule })
620e41f4b71Sopenharmony_ci          .width('80%')
621e41f4b71Sopenharmony_ci          .height(35)
622e41f4b71Sopenharmony_ci          .margin(10)
623e41f4b71Sopenharmony_ci          .onClick(() => {
624e41f4b71Sopenharmony_ci            this.helper.replacePath('hsptest2', { name: 'pageTwo', param: new ParamWithOp(), onPop: (popInfo: PopInfo) => {
625e41f4b71Sopenharmony_ci              this.message = '[replacePath with NavigationOptions]last page is: ' + popInfo.info.name + ', result: ' + JSON.stringify(popInfo.result);
626e41f4b71Sopenharmony_ci            }}, {launchMode:0, animated:true}).catch((error: BusinessError) => {
627e41f4b71Sopenharmony_ci              console.error(`[replacePath with NavigationOptions]failed, error code = ${error.code}, error.message = ${error.message}.`);
628e41f4b71Sopenharmony_ci            }).then(() => {
629e41f4b71Sopenharmony_ci              console.log('[replacePath with NavigationOptions]success.');
630e41f4b71Sopenharmony_ci            });
631e41f4b71Sopenharmony_ci          })
632e41f4b71Sopenharmony_ci
633e41f4b71Sopenharmony_ci        Button('replacePathByName', { stateEffect: true, type: ButtonType.Capsule })
634e41f4b71Sopenharmony_ci          .width('80%')
635e41f4b71Sopenharmony_ci          .height(35)
636e41f4b71Sopenharmony_ci          .margin(10)
637e41f4b71Sopenharmony_ci          .onClick(() => {
638e41f4b71Sopenharmony_ci            let tmp = new TmpClass()
639e41f4b71Sopenharmony_ci            this.helper.replacePathByName('hsptest2', 'pageTwo', tmp)
640e41f4b71Sopenharmony_ci              .catch((error: BusinessError) => {
641e41f4b71Sopenharmony_ci              console.error(`[replacePathByName]failed, error code = ${error.code}, error.message = ${error.message}.`);
642e41f4b71Sopenharmony_ci            }).then(() => {
643e41f4b71Sopenharmony_ci              console.log('[replacePathByName]success.');
644e41f4b71Sopenharmony_ci            });
645e41f4b71Sopenharmony_ci          })
646e41f4b71Sopenharmony_ci
647e41f4b71Sopenharmony_ci      }.width('100%').height('100%')
648e41f4b71Sopenharmony_ci    }.title('pageOne')
649e41f4b71Sopenharmony_ci    .onBackPressed(() => {
650e41f4b71Sopenharmony_ci      this.pageInfo.pop({ number: 1 }) // Pop the top element out of the navigation stack.
651e41f4b71Sopenharmony_ci      return true
652e41f4b71Sopenharmony_ci    }).onReady((context: NavDestinationContext) => {
653e41f4b71Sopenharmony_ci      this.pageInfo = context.pathStack;
654e41f4b71Sopenharmony_ci      this.helper = new NavPushPathHelper(this.pageInfo);
655e41f4b71Sopenharmony_ci    })
656e41f4b71Sopenharmony_ci  }
657e41f4b71Sopenharmony_ci}
658e41f4b71Sopenharmony_ci```
659e41f4b71Sopenharmony_ci
660e41f4b71Sopenharmony_ci```json
661e41f4b71Sopenharmony_ci// Configure {"routerMap": "$profile:route_map"} in the project configuration file module.json5.
662e41f4b71Sopenharmony_ci// route_map.json
663e41f4b71Sopenharmony_ci{
664e41f4b71Sopenharmony_ci  "routerMap": [
665e41f4b71Sopenharmony_ci    {
666e41f4b71Sopenharmony_ci      "name": "pageOne",
667e41f4b71Sopenharmony_ci      "pageSourceFile": "src/main/ets/pages/PageOne.ets",
668e41f4b71Sopenharmony_ci      "buildFunction": "PageOneBuilder",
669e41f4b71Sopenharmony_ci      "data": {
670e41f4b71Sopenharmony_ci        "description": "this is pageOne"
671e41f4b71Sopenharmony_ci      }
672e41f4b71Sopenharmony_ci    }
673e41f4b71Sopenharmony_ci  ]
674e41f4b71Sopenharmony_ci}
675e41f4b71Sopenharmony_ci```
676e41f4b71Sopenharmony_ci
677e41f4b71Sopenharmony_ciSubpackage **hsptest2**:
678e41f4b71Sopenharmony_ci```ts
679e41f4b71Sopenharmony_ci// PageTwo.ets
680e41f4b71Sopenharmony_ci
681e41f4b71Sopenharmony_ciclass resultClass {
682e41f4b71Sopenharmony_ci  constructor(count: number) {
683e41f4b71Sopenharmony_ci    this.count = count;
684e41f4b71Sopenharmony_ci  }
685e41f4b71Sopenharmony_ci  count: number = 10
686e41f4b71Sopenharmony_ci}
687e41f4b71Sopenharmony_ci
688e41f4b71Sopenharmony_ci@Builder
689e41f4b71Sopenharmony_ciexport function PageTwoBuilder() {
690e41f4b71Sopenharmony_ci  PageTwo()
691e41f4b71Sopenharmony_ci}
692e41f4b71Sopenharmony_ci
693e41f4b71Sopenharmony_ci@Component
694e41f4b71Sopenharmony_ciexport struct PageTwo {
695e41f4b71Sopenharmony_ci  pathStack: NavPathStack = new NavPathStack()
696e41f4b71Sopenharmony_ci
697e41f4b71Sopenharmony_ci  build() {
698e41f4b71Sopenharmony_ci    NavDestination() {
699e41f4b71Sopenharmony_ci      Column() {
700e41f4b71Sopenharmony_ci        Button('pop', { stateEffect: true, type: ButtonType.Capsule })
701e41f4b71Sopenharmony_ci          .width('80%')
702e41f4b71Sopenharmony_ci          .height(40)
703e41f4b71Sopenharmony_ci          .margin(20)
704e41f4b71Sopenharmony_ci          .onClick(() => {
705e41f4b71Sopenharmony_ci            this.pathStack.pop(new resultClass(1)); // Return to the previous page and pass in the processing result to the onPop callback of push.
706e41f4b71Sopenharmony_ci          })
707e41f4b71Sopenharmony_ci      }.width('100%').height('100%')
708e41f4b71Sopenharmony_ci    }.title('pageTwo')
709e41f4b71Sopenharmony_ci    .onBackPressed(() => {
710e41f4b71Sopenharmony_ci      this.pathStack.pop(new resultClass(0)); // Return to the previous page and pass in the processing result to the onPop callback of push.
711e41f4b71Sopenharmony_ci      return true;
712e41f4b71Sopenharmony_ci    }).onReady((context: NavDestinationContext) => {
713e41f4b71Sopenharmony_ci      this.pathStack = context.pathStack
714e41f4b71Sopenharmony_ci    })
715e41f4b71Sopenharmony_ci  }
716e41f4b71Sopenharmony_ci}
717e41f4b71Sopenharmony_ci```
718e41f4b71Sopenharmony_ci
719e41f4b71Sopenharmony_ci```json
720e41f4b71Sopenharmony_ci// Configure {"routerMap": "$profile:route_map"} in the project configuration file module.json5.
721e41f4b71Sopenharmony_ci// route_map.json
722e41f4b71Sopenharmony_ci{
723e41f4b71Sopenharmony_ci  "routerMap": [
724e41f4b71Sopenharmony_ci    {
725e41f4b71Sopenharmony_ci      "name": "pageTwo",
726e41f4b71Sopenharmony_ci      "pageSourceFile": "src/main/ets/pages/PageTwo.ets",
727e41f4b71Sopenharmony_ci      "buildFunction": "PageTwoBuilder",
728e41f4b71Sopenharmony_ci      "data": {
729e41f4b71Sopenharmony_ci        "description": "this is pageTwo"
730e41f4b71Sopenharmony_ci      }
731e41f4b71Sopenharmony_ci    }
732e41f4b71Sopenharmony_ci  ]
733e41f4b71Sopenharmony_ci}
734e41f4b71Sopenharmony_ci```
735e41f4b71Sopenharmony_ci![NavPushPathHelperDemo.gif](figures/NavPushPathHelperDemo.gif)
736