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
|
||
|---|---|---|
| .. | ||
| integrationtest | ||
| linker | ||
| ngcc | ||
| private | ||
| src | ||
| test | ||
| BUILD.bazel | ||
| esbuild.config.js | ||
| index.ts | ||
| package.json | ||
| tsconfig-build.json | ||
| tsconfig.json | ||