mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
0c4c773fca
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
Angular
The sources for this package are in the main Angular repo. Please file issues and pull requests against that repo.
Usage information and reference details can be found in Angular documentation.
License: MIT