Commit 0162ceb
fix(core): inject migration should treat @Attribute as optional (angular#60916)
The @Attribute decorator will inject null if a host attribute
is missing, but `inject(new HostAttributeToken(...))` will throw
a no provider error. We should set {optional: true} when migrating
an @Attribute decorator. Also allow nonNullableOptional to add
`!` to those declarations.
PR Close angular#609161 parent 037dede commit 0162ceb
File tree
2 files changed
+42
-8
lines changed- packages/core/schematics
- ng-generate/inject-migration
- test
2 files changed
+42
-8
lines changedLines changed: 16 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
409 | 409 | | |
410 | 410 | | |
411 | 411 | | |
412 | | - | |
| 412 | + | |
413 | 413 | | |
414 | 414 | | |
415 | 415 | | |
| |||
451 | 451 | | |
452 | 452 | | |
453 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
454 | 457 | | |
455 | 458 | | |
456 | 459 | | |
457 | 460 | | |
458 | 461 | | |
459 | | - | |
| 462 | + | |
460 | 463 | | |
461 | 464 | | |
462 | 465 | | |
463 | | - | |
| 466 | + | |
464 | 467 | | |
465 | 468 | | |
466 | 469 | | |
467 | | - | |
| 470 | + | |
468 | 471 | | |
469 | 472 | | |
470 | 473 | | |
471 | | - | |
| 474 | + | |
472 | 475 | | |
473 | 476 | | |
474 | 477 | | |
| |||
479 | 482 | | |
480 | 483 | | |
481 | 484 | | |
482 | | - | |
483 | | - | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
484 | 493 | | |
485 | 494 | | |
486 | 495 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
194 | 194 | | |
195 | 195 | | |
196 | 196 | | |
197 | | - | |
| 197 | + | |
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| |||
1256 | 1256 | | |
1257 | 1257 | | |
1258 | 1258 | | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
| 1263 | + | |
| 1264 | + | |
| 1265 | + | |
| 1266 | + | |
| 1267 | + | |
| 1268 | + | |
| 1269 | + | |
| 1270 | + | |
| 1271 | + | |
| 1272 | + | |
| 1273 | + | |
| 1274 | + | |
| 1275 | + | |
| 1276 | + | |
| 1277 | + | |
| 1278 | + | |
| 1279 | + | |
| 1280 | + | |
| 1281 | + | |
| 1282 | + | |
| 1283 | + | |
1259 | 1284 | | |
1260 | 1285 | | |
1261 | 1286 | | |
| |||
0 commit comments