princemaple / ngx-html-syntax

Ngx (Angular2+) HTML Syntax for SublimeText
https://packagecontrol.io/packages/Ngx%20HTML
MIT License
15 stars 3 forks source link

[Feature Request] Update Syntax to coincide with new Angular17 syntax #23

Closed thecodechef closed 8 months ago

thecodechef commented 10 months ago

update the syntax to use the Angular17 control-flow block syntax https://angular.dev For Statement

@for (item of items) {
  <a [href]="item.link">{{item.title}}</a>
}

For/Empty Statement

@for (item of items) {
  <a [href]="item.link">{{item.title}}</a>
} @empty {
  <p>No Items</p>
}

If Statement

@if (users$ | async; as users) {
  {{ users.length }}
}

If/Else Statement

@if (a > b) {
  {{a}} is greater than {{b}}
} @else if (b > a) {
  {{a}} is less than {{b}}
} @else {
  {{a}} is equal to {{b}}
}

Switch Statement

@switch (condition) {
  @case (caseA) {
    Case A.
  }
  @case (caseB) {
    Case B.
  }
  @default {
    Default case.
  }
}

Defer Statement

@defer ( on <trigger>; when <condition>; prefetch on <trigger>; prefetch when <condition> ) {
  <!-- deferred template fragment -->
  <calendar-cmp />
} @placeholder ( minimum? <duration> ) {
  <!-- placeholder template fragment -->
  <p>Placeholder</p>
} @loading ( minimum? <duration>; after? <duration> ) {
  <!-- loading template fragment -->
  <img alt="loading image" src="loading.gif" />
} @error {
  <!-- error template fragment -->
  <p>An loading error occured</p>
}
princemaple commented 10 months ago

Would love some community contribution 😉

princemaple commented 8 months ago

It was released yesterday and thanks for your contribution!