MCPcopy Index your code
hub / github.com/angular/angular / subscribe

Method subscribe

packages/common/src/location/location.ts:262–272  ·  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 value Event that is triggered when the state history changes. * @param ex

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

Source from the content-addressed store, hash-verified

260 * @returns Subscribed events.
261 */
262 subscribe(
263 onNext: (value: PopStateEvent) => void,
264 onThrow?: ((exception: any) => void) | null,
265 onReturn?: (() => void) | null,
266 ): SubscriptionLike {
267 return this._subject.subscribe({
268 next: onNext,
269 error: onThrow ?? undefined,
270 complete: onReturn ?? undefined,
271 });
272 }
273
274 /**
275 * 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