Skip to content

Commit

Permalink
fix: issue with angular events using camelCase (#1556)
Browse files Browse the repository at this point in the history
* fix: issue with angular events using camelCase

* chore: update changeset

* chore: update snapshots
  • Loading branch information
nmerget authored Sep 30, 2024
1 parent 75d816e commit 7e2c95f
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/curly-hats-tell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@builder.io/mitosis': patch
---

[Angular] fix: issue with angular events not transformed to lower-case
Original file line number Diff line number Diff line change
Expand Up @@ -4830,7 +4830,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -12083,7 +12083,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4906,7 +4906,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -12276,7 +12276,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4999,7 +4999,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -12498,7 +12498,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4352,7 +4352,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -10874,7 +10874,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9109,7 +9109,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -9147,7 +9147,7 @@ import { CommonModule } from \\"@angular/common\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -22780,7 +22780,7 @@ import { Component } from \\"@angular/core\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down Expand Up @@ -22818,7 +22818,7 @@ import { CommonModule } from \\"@angular/common\\";
<input
[attr.value]=\\"name\\"
(input)=\\"name = $event.target.value\\"
(changeOrSomething)=\\"name = $event.target.value\\"
(changeorsomething)=\\"name = $event.target.value\\"
/>

Hello! I can run in React, Vue, Solid, or Liquid!
Expand Down
3 changes: 2 additions & 1 deletion packages/core/src/generators/angular/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,8 @@ const stringifyBinding =

if (keyToUse.startsWith('on')) {
const { event, value } = processEventBinding(keyToUse, code, node.name, cusArgs[0]);
return ` (${event})="${value}"`;
// Angular events are all lowerCased
return ` (${event.toLowerCase()})="${value}"`;
} else if (keyToUse === 'class') {
return ` [class]="${code}" `;
} else if (keyToUse === 'ref' || keyToUse === 'spreadRef') {
Expand Down

0 comments on commit 7e2c95f

Please sign in to comment.