mirror of
https://github.com/angular/angular
synced 2026-05-24 09:28:37 +00:00
Adds the logic to generate the instructions for `switch` instructions. For the following block:
```html
{#switch value()}
{:case 0} case 0
{:case 1} case 1
{:case 2} case 2
{:default} default
{/switch}
```
The compiler will produce the following output:
```ts
function App_Template(rf, ctx) {
if (rf & 1) {
ɵɵtemplate(0, App_Case_0_Template, 1, 0);
ɵɵtemplate(1, App_Case_1_Template, 1, 0);
ɵɵtemplate(2, App_Case_2_Template, 1, 0);
ɵɵtemplate(3, App_Case_3_Template, 1, 0);
}
if (rf & 2) {
let App_contFlowTmp;
ɵɵconditional(0, (App_contFlowTmp = ctx.value()) === 0 ? 0 : App_contFlowTmp === 1 ? 1 : App_contFlowTmp === 2 ? 2 : 3);
}
}
```
PR Close #51380
|
||
|---|---|---|
| .. | ||
| compliance | ||
| ngtsc | ||
| BUILD.bazel | ||
| downlevel_decorators_transform_spec.ts | ||
| extract_i18n_spec.ts | ||
| mocks.ts | ||
| perform_compile_spec.ts | ||
| perform_watch_spec.ts | ||
| test_support.ts | ||
| typescript_support_spec.ts | ||
| version_helpers_spec.ts | ||