angular / angular/angular

Expose strategies that correspond to string values of runGuardsAndResolvers

Aperta
#53,946 1 commento 12 reazioni 0 assegnatari Vedi su GitHub
area: router feature
Lingua principale
TypeScript
Stelle
101k
Fork
27.5k
Merge medio
1g 19h
PR unite (30g)
288

Descrizione

### Which @angular/* package(s) are relevant/related to the feature request?

router

### Description

Given that runGuardsAndResolvers may take a custom strategy in form of a function, it makes sense to expose the set of predefined strategies `'pathParamsChange' | 'pathParamsOrQueryParamsChange' | 'paramsChange' | 'paramsOrQueryParamsChange' | 'always'` so that consumers can compose with them, as was done in case of defaultUrlMatcher, see https://github.com/angular/angular/issues/35928. Also related https://github.com/angular/angular/issues/31843#issuecomment-1890955590

### Proposed solution

Make the strategies part of public api:

```
import { RunGuardsAndResolversStrategies } from '@angular/router';
```

Being:

```
class RunGuardsAndResolversStrategies {
static pathParamsChange() { ... }
static pathParamsOrQueryParamsChange() { ... }
static paramsChange() { ... }
static paramsOrQueryParamsChange() { ... }
static always() { ... }
}
```

### Alternatives considered

Copy paste the code from Angular source code or reimplement said strategies.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start in the @angular/router implementation of runGuardsAndResolvers and trace how its predefined string strategies are defined and exported through the public router entry point. The work is done when the five strategies are publicly importable as RunGuardsAndResolversStrategies and can be composed by consumers without reimplementing them.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
angular, typescript
Ambito
frontend
Tipo di issue
Funzionalità
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Specificata chiaramente
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.