-
Notifications
You must be signed in to change notification settings - Fork 239
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Including Angular >v17 signal syntax examples #241
Comments
Hi! I just discovered this awesome project and I think the same as you! |
Also, the reason why I propose a name like "Angular renaissance" (or similar) is because many changes came from v14 (like |
From a non-Angular developer, If you want to contribute, you can maybe check this PR #234 or submit a new PR. |
The thing is that it won't only be arround signals but also arround the new control flow, signals, the standalone, the new @Component({
standalone: true,
imports: [Button],
selector: 'app-root',
styles: `
:host {
display: block;
padding: 1rem;
}
`,
template: `
@for (color of colors(); track color) {
<app-button [color]="color">{{ color }} button</app-button>
}
`
})
export class AppComponent {
readonly colors = signals(['red', 'green']);
constructor() {
this.colors.update(colors => [...colors, 'blue']);
}
// and so on
} instead of: @Component({
selector: 'app-root',
styles: [
`
:host {
display: block;
padding: 1rem;
}
`
],
template: `
<app-button *ngFor="let color of colors; trackBy: trackByColor" [color]="color">{{ color }} button</app-button>
`
})
export class AppComponent {
readonly colors = ['red', 'green'];
constructor() {
this.colors.push('blue'); // looks simpler but considering the fact that angular is becoming zoneless, it is not + like this the perfs can be badly impacted
}
// I add this simply because it is now obligated with the new control flow, that also simplified it
trackByColor(color: string) {
return color;
}
// and so on
}
@NgModule({
declarations: [AppComponent],
imports: [Button, NgFor],
export: [AppComponent]
})
export class AppModule {} And there, I missed a lot of other new features that makes Angular easier that it used to be... |
About the PR #234 it is a very good basis but can be improved with other new features (like the |
And what about |
Ok let's be clear, what would be responsabilities of these on Component Party:
I think:
What do you think ? |
I think that's great! |
I made all the changes (even in the "Angular" files to better show the diff with "Angular Renaissance" but:
pnpm run dev
> [email protected] dev /home/lucas/dev/component-party.dev
> vite
[generateFrameworkContent] Generating framework content files...
TypeError: Cannot read properties of undefined (reading 'push')
at file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2843:40
at async Promise.all (index 4)
at async generateContent (file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2831:7)
at async build (file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2981:7)
at async PluginContext.buildStart (file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2997:9)
at async Promise.all (index 6)
at async PluginContainer.hookParallel (file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:49481:5)
at async PluginContainer.buildStart (file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:49484:5)
at async file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:63425:7
at async httpServer.listen (file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:63440:9)
error when starting dev server:
TypeError: Cannot read properties of undefined (reading 'push')
at file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2843:40
at async Promise.all (index 4)
at async generateContent (file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2831:7)
at async build (file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2981:7)
at async PluginContext.buildStart (file:///home/lucas/dev/component-party.dev/vite.config.js.timestamp-1721509708644-d2f6b8691061.mjs:2997:9)
at async Promise.all (index 6)
at async PluginContainer.hookParallel (file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:49481:5)
at async PluginContainer.buildStart (file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:49484:5)
at async file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:63425:7
at async httpServer.listen (file:///home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]_@[email protected][email protected]/node_modules/vite/dist/node/chunks/dep-D8YhmIY-.js:63440:9)
ELIFECYCLE Command failed with exit code 1.
git commit -m "feat(angular): update the existing files + add the new angular (renaissance) practices"
✔ Preparing lint-staged...
⚠ Running tasks for staged files...
❯ package.json — 66 files
❯ *.{js,jsx,ts,tsx,vue,gjs} — 62 files
✖ eslint --cache --fix [FAILED]
↓ **/svelte4/*.svelte — no files
❯ *.{js,jsx,ts,tsx,svelte,vue,html,md,css,hbs} — 64 files
✖ prettier --cache --write [KILLED]
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...
✖ eslint --cache --fix:
Oops! Something went wrong! :(
ESLint: 8.57.0
TypeError: Cannot read config file: /home/lucas/dev/component-party.dev/.eslintrc.cjs
Error: Function.prototype.apply was called on undefined, which is a undefined and not a function
at $o (/home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]/node_modules/esm/esm.js:1:224377)
at wu (/home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]/node_modules/esm/esm.js:1:227324)
at Eu (/home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]/node_modules/esm/esm.js:1:227999)
at Module.<anonymous> (/home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]/node_modules/esm/esm.js:1:295976)
at require (/home/lucas/dev/component-party.dev/node_modules/.pnpm/[email protected]/node_modules/esm/esm.js:1:279589)
at Object.<anonymous> (/home/lucas/dev/component-party.dev/.eslintrc.cjs:2:18)
at Module._compile (node:internal/modules/cjs/loader:1460:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1544:10)
at Module.load (node:internal/modules/cjs/loader:1275:32)
at Module._load (node:internal/modules/cjs/loader:1091:12)
(node:28584) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
✖ prettier --cache --write failed without output (KILLED).
husky - pre-commit script failed (code 1) I actually have no idea what I did wrong 😅 |
If you can and if you want, you can reach me on discord to find what's the issue. My username is |
I think there is an error on your modifications to |
Okay thanks, I'll do that! |
Hi @matschik, could you take a look at my draft ? |
This issue can be closed now |
Angular has introduced new signal-based primitives for state management that are likely to become the golden path moving forward, similar to how Svelte is changing their primitives between v4 and v5.
Would project maintainers consider a PR that adds Angular signal syntax examples a welcome contribution? If so, I'd be open to giving it a go.
The text was updated successfully, but these errors were encountered: