lekhmanrus / ngx-pug-builders

Angular Pug Builders
MIT License
24 stars 4 forks source link

Angular 17 new control flow and templating system #10

Closed medi6 closed 12 months ago

medi6 commented 1 year ago

Feature Description

Hi,

A lot of new templating features will come with Angular 17. https://blog.angular.io/meet-angulars-new-control-flow-a02c6eee7843

On first sight, I don't think that they'll be compatibles with Ngx Pug Builders and particularly Pug.

What do you think about this ?

Thanks for all,

Use Case

No response

jmbarbier commented 1 year ago

It may not be impossible, pug can be used with react-style components : https://github.com/pugjs/babel-plugin-transform-react-pug

but it will need some work, and may not be useful with some IDEs

lekhmanrus commented 1 year ago

Hi,

I think it still should be possible to use the following syntax:

| @if (user.isHuman) {
human-profile([data]='user')
| } @else if (user.isRobot) {
// robot users are rare, so load their profiles lazily
| @defer {
robot-profile([data]='user')
| }
| } @else {
p
  | The profile is unknown!
| }

which will be compiled to

@if (user.isHuman) {
<human-profile [data]="user"></human-profile>
} @else if (user.isRobot) {
<!-- robot users are rare, so load their profiles lazily-->
@defer {
<robot-profile [data]="user"></robot-profile>
}
} @else {
<p>The profile is unknown!</p>
}

But I haven't checked that yet and still need work on v17.