@angular/router 7.2.8 → 7.2.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/router.d.ts CHANGED
@@ -20,7 +20,7 @@ import { Checks } from './utils/preactivation';
20
20
  /**
21
21
  * @description
22
22
  *
23
- * Represents the extra options used during navigation.
23
+ * Options that modify the navigation strategy.
24
24
  *
25
25
  * @publicApi
26
26
  */
@@ -77,9 +77,8 @@ export interface NavigationExtras {
77
77
  */
78
78
  fragment?: string;
79
79
  /**
80
- * Preserves the query parameters for the next navigation.
81
- *
82
- * deprecated, use `queryParamsHandling` instead
80
+ * DEPRECATED: Use `queryParamsHandling` instead to preserve
81
+ * query parameters for the next navigation.
83
82
  *
84
83
  * ```
85
84
  * // Preserve query params from /results?page=1 to /view?page=1
@@ -90,7 +89,7 @@ export interface NavigationExtras {
90
89
  */
91
90
  preserveQueryParams?: boolean;
92
91
  /**
93
- * config strategy to handle the query parameters for the next navigation.
92
+ * Configuration strategy for how to handle query parameters for the next navigation.
94
93
  *
95
94
  * ```
96
95
  * // from /results?page=1 to /view?page=1&page=2
@@ -225,9 +224,10 @@ export declare type NavigationTransition = {
225
224
  /**
226
225
  * @description
227
226
  *
228
- * Provides the navigation and url manipulation capabilities.
227
+ * An NgModule that provides navigation and URL manipulation capabilities.
229
228
  *
230
- * See `Routes` for more details and examples.
229
+ * @see `Route`.
230
+ * @see [Routing and Navigation Guide](guide/router).
231
231
  *
232
232
  * @ngModule RouterModule
233
233
  *
@@ -252,12 +252,16 @@ export declare class Router {
252
252
  private ngModule;
253
253
  private console;
254
254
  private isNgZoneEnabled;
255
+ /**
256
+ * An event stream for routing events in this NgModule.
257
+ */
255
258
  readonly events: Observable<Event>;
259
+ /**
260
+ * The current state of routing in this NgModule.
261
+ */
256
262
  readonly routerState: RouterState;
257
263
  /**
258
- * Error handler that is invoked when a navigation errors.
259
- *
260
- * See `ErrorHandler` for more information.
264
+ * A handler for navigation errors in this NgModule.
261
265
  */
262
266
  errorHandler: ErrorHandler;
263
267
  /**
@@ -267,7 +271,8 @@ export declare class Router {
267
271
  */
268
272
  malformedUriErrorHandler: (error: URIError, urlSerializer: UrlSerializer, url: string) => UrlTree;
269
273
  /**
270
- * Indicates if at least one navigation happened.
274
+ * True if at least one navigation event has occurred,
275
+ * false otherwise.
271
276
  */
272
277
  navigated: boolean;
273
278
  private lastSuccessfulId;
@@ -275,21 +280,24 @@ export declare class Router {
275
280
  * Extracts and merges URLs. Used for AngularJS to Angular migrations.
276
281
  */
277
282
  urlHandlingStrategy: UrlHandlingStrategy;
283
+ /**
284
+ * The strategy for re-using routes.
285
+ */
278
286
  routeReuseStrategy: RouteReuseStrategy;
279
287
  /**
280
- * Define what the router should do if it receives a navigation request to the current URL.
281
- * By default, the router will ignore this navigation. However, this prevents features such
282
- * as a "refresh" button. Use this option to configure the behavior when navigating to the
283
- * current URL. Default is 'ignore'.
288
+ * How to handle a navigation request to the current URL. One of:
289
+ * - `'ignore'` : The router ignores the request.
290
+ * - `'reload'` : The router reloads the URL. Use to implement a "refresh" feature.
284
291
  */
285
292
  onSameUrlNavigation: 'reload' | 'ignore';
286
293
  /**
287
- * Defines how the router merges params, data and resolved data from parent to child
288
- * routes. Available options are:
294
+ * How to merge parameters, data, and resolved data from parent to child
295
+ * routes. One of:
289
296
  *
290
- * - `'emptyOnly'`, the default, only inherits parent params for path-less or component-less
291
- * routes.
292
- * - `'always'`, enables unconditional inheritance of parent params.
297
+ * - `'emptyOnly'` : Inherit parent parameters, data, and resolved data
298
+ * for path-less or component-less routes.
299
+ * - `'always'` : Inherit parent parameters, data, and resolved data
300
+ * for all child routes.
293
301
  */
294
302
  paramsInheritanceStrategy: 'emptyOnly' | 'always';
295
303
  /**
@@ -322,16 +330,16 @@ export declare class Router {
322
330
  * Sets up the location change listener.
323
331
  */
324
332
  setUpLocationChangeListener(): void;
325
- /** The current url */
333
+ /** The current URL. */
326
334
  readonly url: string;
327
335
  /** The current Navigation object if one exists */
328
336
  getCurrentNavigation(): Navigation | null;
329
337
  /**
330
338
  * Resets the configuration used for navigation and generating links.
331
339
  *
332
- * @usageNotes
340
+ * @param config The route array for the new configuration.
333
341
  *
334
- * ### Example
342
+ * @usageNotes
335
343
  *
336
344
  * ```
337
345
  * router.resetConfig([
@@ -345,17 +353,19 @@ export declare class Router {
345
353
  resetConfig(config: Routes): void;
346
354
  /** @docsNotRequired */
347
355
  ngOnDestroy(): void;
348
- /** Disposes of the router */
356
+ /** Disposes of the router. */
349
357
  dispose(): void;
350
358
  /**
351
- * Applies an array of commands to the current url tree and creates a new url tree.
359
+ * Applies an array of commands to the current URL tree and creates a new URL tree.
352
360
  *
353
361
  * When given an activate route, applies the given commands starting from the route.
354
362
  * When not given a route, applies the given command starting from the root.
355
363
  *
356
- * @usageNotes
364
+ * @param commands An array of commands to apply.
365
+ * @param navigationExtras
366
+ * @returns The new URL tree.
357
367
  *
358
- * ### Example
368
+ * @usageNotes
359
369
  *
360
370
  * ```
361
371
  * // create /team/33/user/11
@@ -392,12 +402,15 @@ export declare class Router {
392
402
  */
393
403
  createUrlTree(commands: any[], navigationExtras?: NavigationExtras): UrlTree;
394
404
  /**
395
- * Navigate based on the provided url. This navigation is always absolute.
405
+ * Navigate based on the provided URL, which must be absolute.
396
406
  *
397
- * Returns a promise that:
398
- * - resolves to 'true' when navigation succeeds,
399
- * - resolves to 'false' when navigation fails,
400
- * - is rejected when an error happens.
407
+ * @param url An absolute URL. The function does not apply any delta to the current URL.
408
+ * @param extras An object containing properties that modify the navigation strategy.
409
+ * The function ignores any properties in the `NavigationExtras` that would change the
410
+ * provided URL.
411
+ *
412
+ * @returns A Promise that resolves to 'true' when navigation succeeds,
413
+ * to 'false' when navigation fails, or is rejected on error.
401
414
  *
402
415
  * @usageNotes
403
416
  *
@@ -410,10 +423,6 @@ export declare class Router {
410
423
  * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
411
424
  * ```
412
425
  *
413
- * Since `navigateByUrl()` takes an absolute URL as the first parameter,
414
- * it will not apply any delta to the current URL and ignores any properties
415
- * in the second parameter (the `NavigationExtras`) that would change the
416
- * provided URL.
417
426
  */
418
427
  navigateByUrl(url: string | UrlTree, extras?: NavigationExtras): Promise<boolean>;
419
428
  /**
@@ -190,51 +190,34 @@ export interface ExtraOptions {
190
190
  /**
191
191
  * Configures if the scroll position needs to be restored when navigating back.
192
192
  *
193
- * * 'disabled'--does nothing (default).
194
- * * 'top'--set the scroll position to 0,0..
195
- * * 'enabled'--set the scroll position to the stored position. This option will be the default in
196
- * the future.
197
- *
198
- * When enabled, the router stores and restores scroll positions during navigation.
199
- * When navigating forward, the scroll position will be set to [0, 0], or to the anchor
200
- * if one is provided.
193
+ * * 'disabled'--does nothing (default). Scroll position will be maintained on navigation.
194
+ * * 'top'--set the scroll position to x = 0, y = 0 on all navigation.
195
+ * * 'enabled'--restores the previous scroll position on backward navigation, else sets the
196
+ * position to the anchor if one is provided, or sets the scroll position to [0, 0] (forward
197
+ * navigation). This option will be the default in the future.
201
198
  *
202
- * You can implement custom scroll restoration behavior as follows.
199
+ * You can implement custom scroll restoration behavior by adapting the enabled behavior as
200
+ * follows:
203
201
  * ```typescript
204
202
  * class AppModule {
205
- * constructor(router: Router, viewportScroller: ViewportScroller, store: Store<AppState>) {
206
- * router.events.pipe(filter(e => e instanceof Scroll), switchMap(e => {
207
- * return store.pipe(first(), timeout(200), map(() => e));
208
- * }).subscribe(e => {
209
- * if (e.position) {
210
- * viewportScroller.scrollToPosition(e.position);
211
- * } else if (e.anchor) {
212
- * viewportScroller.scrollToAnchor(e.anchor);
213
- * } else {
214
- * viewportScroller.scrollToPosition([0, 0]);
215
- * }
216
- * });
217
- * }
218
- * }
219
- * ```
220
- *
221
- * You can also implement component-specific scrolling like this:
222
- *
223
- * ```typescript
224
- * class ListComponent {
225
- * list: any[];
226
- * constructor(router: Router, viewportScroller: ViewportScroller, fetcher: ListFetcher) {
227
- * const scrollEvents = router.events.filter(e => e instanceof Scroll);
228
- * listFetcher.fetch().pipe(withLatestFrom(scrollEvents)).subscribe(([list, e]) => {
229
- * this.list = list;
230
- * if (e.position) {
231
- * viewportScroller.scrollToPosition(e.position);
232
- * } else {
233
- * viewportScroller.scrollToPosition([0, 0]);
234
- * }
235
- * });
236
- * }
237
- * }
203
+ * constructor(router: Router, viewportScroller: ViewportScroller) {
204
+ * router.events.pipe(
205
+ * filter((e: Event): e is Scroll => e instanceof Scroll)
206
+ * ).subscribe(e => {
207
+ * if (e.position) {
208
+ * // backward navigation
209
+ * viewportScroller.scrollToPosition(e.position);
210
+ * } else if (e.anchor) {
211
+ * // anchor navigation
212
+ * viewportScroller.scrollToAnchor(e.anchor);
213
+ * } else {
214
+ * // forward navigation
215
+ * viewportScroller.scrollToPosition([0, 0]);
216
+ * }
217
+ * });
218
+ * }
219
+ * }
220
+ * ```
238
221
  */
239
222
  scrollPositionRestoration?: 'disabled' | 'enabled' | 'top';
240
223
  /**
package/testing.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v7.2.8
2
+ * @license Angular v7.2.12
3
3
  * (c) 2010-2019 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/upgrade.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v7.2.8
2
+ * @license Angular v7.2.12
3
3
  * (c) 2010-2019 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */