Skip to content

Commit 7f85d18

Browse files
dgp1130AndrewKushnir
authored andcommitted
fix(devtools): handle case where directive metadata has undefined dependencies (angular#60256)
This fixes a bug introduced by [angular#60206](https://github.com/angular/angular/pull/60206/files#diff-c07b9ecd59f6e0ed636ac9672b9644178d9a999f04bc8b8198b13e86589dfa5b). Previously `DirectiveMetadata.prototype.dependencies` was always set, but in that PR `dependencies` is only set if an `Injector` is found (which only happens when `ng.getInjector` is *not* defined). This causes an error when evaluating `dependencies.length` in the template. Fix is just to check for existance before calling `length`. PR Close angular#60256
1 parent 1eedfce commit 7f85d18

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

devtools/projects/ng-devtools/src/lib/devtools-tabs/directive-explorer/property-tab/property-view/property-view-body.component.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
@if (controlsLoaded()) {
22
<mat-accordion cdkDropList (cdkDropListDropped)="drop($event)" [multi]="true">
3-
@if (controller().directiveMetadata?.dependencies.length > 0) {
3+
@let dependencies = controller().directiveMetadata?.dependencies;
4+
@if (dependencies && dependencies.length > 0) {
45
<div class="mat-accordion-content">
56
<mat-expansion-panel [expanded]="true">
67
<mat-expansion-panel-header collapsedHeight="25px" expandedHeight="25px">

0 commit comments

Comments
 (0)