MCPcopy Create free account
hub / github.com/angular/angular / subscribe

Method subscribe

packages/common/src/location/location.ts:269–279  ·  view source on GitHub ↗

* Subscribes to the platform's `popState` events. * * Note: `Location.go()` does not trigger the `popState` event in the browser. Use * `Location.onUrlChange()` to subscribe to URL changes instead. * * @param onNext Callback invoked with the event that is triggered when the state hist

(
    onNext: (value: PopStateEvent) => void,
    onThrow?: ((exception: any) => void) | null,
    onReturn?: (() => void) | null,
  )

Source from the content-addressed store, hash-verified

267 * @returns Subscribed events.
268 */
269 subscribe(
270 onNext: (value: PopStateEvent) => void,
271 onThrow?: ((exception: any) => void) | null,
272 onReturn?: (() => void) | null,
273 ): SubscriptionLike {
274 return this._subject.subscribe({
275 next: onNext,
276 error: onThrow ?? undefined,
277 complete: onReturn ?? undefined,
278 });
279 }
280
281 /**
282 * Normalizes URL parameters by prepending with `?` if needed.

Callers 1

onUrlChangeMethod · 0.95

Implementers 1

SpyLocationpackages/common/testing/src/location_m

Calls 1

subscribeMethod · 0.65

Tested by

no test coverage detected