forked from angular/angular
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(router): Ensure ActivatedRouteSnapshot#title has correct value (a…
…ngular#47481) ActivatedRouteSnapshot data gets mutated in the resolve phase of the Router. The title is assigned as part of this. As a result, the title must be a getter in order to pick up the value that was note available during the class creation. fixes angular#47459 BREAKING CHANGE: The title property is now required on ActivatedRouteSnapshot PR Close angular#47481
- Loading branch information
Showing
4 changed files
with
71 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
|
||
import ts from 'typescript'; | ||
|
||
import {Reference} from '../../imports'; | ||
import {DirectiveMeta, MetadataReader, MetadataRegistry, MetaKind, NgModuleMeta, PipeMeta} from '../../metadata'; | ||
import {ClassDeclaration} from '../../reflection'; | ||
|
||
export class GlobalDirectiveRegistry implements MetadataRegistry, MetadataReader { | ||
constructor() {} | ||
|
||
knownDirectives = new Map<ClassDeclaration, DirectiveMeta>(); | ||
knownNgModules = new Map<ClassDeclaration, NgModuleMeta>(); | ||
|
||
get knownStandaloneDirectives(): Map<ClassDeclaration, DirectiveMeta> { | ||
return new Map([...this.knownDirectives].filter(([k, v]) => v.isStandalone)); | ||
} | ||
|
||
registerNgModuleMetadata(mod: NgModuleMeta): void { | ||
this.knownNgModules.set(mod.ref.node, mod); | ||
} | ||
|
||
registerDirectiveMetadata(directive: DirectiveMeta): void { | ||
this.knownDirectives.set(directive.ref.node, directive); | ||
} | ||
|
||
registerPipeMetadata(pipe: PipeMeta): void {} | ||
|
||
getDirectiveMetadata(ref: Reference<ClassDeclaration>): DirectiveMeta|null { | ||
if (this.knownDirectives.has(ref.node)) { | ||
return this.knownDirectives.get(ref.node)!; | ||
} | ||
return null; | ||
} | ||
|
||
getNgModuleMetadata(ref: Reference<ClassDeclaration>): NgModuleMeta|null { | ||
if (this.knownNgModules.has(ref.node)) { | ||
return this.knownNgModules.get(ref.node)!; | ||
} | ||
return null; | ||
} | ||
|
||
getPipeMetadata(ref: Reference<ClassDeclaration>): PipeMeta|null { | ||
return null; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters