diff --git a/.changeset/polite-pugs-pull.md b/.changeset/polite-pugs-pull.md new file mode 100644 index 0000000000..fa41d48add --- /dev/null +++ b/.changeset/polite-pugs-pull.md @@ -0,0 +1,31 @@ +--- +'@builder.io/mitosis': patch +--- + +[angular]: Fix issue with events forced to become `toLowerCase()`. + +Based on [choosing-event-names](https://angular.dev/guide/components/outputs#choosing-event-names) custom events are camelCase. +[DOM events](https://www.w3schools.com/jsref/dom_obj_event.asp) are always lower-cased for Angular components. + +Checkout [event-handlers.ts](https://github.com/BuilderIO/mitosis/blob/main/packages/core/src/helpers/event-handlers.ts) to see all events which are automatically lower-cased everything else will be camelCase. + +If you need some other event to be lower-cased you can use `useMetadata.angular.nativeEvents`: + +```tsx +import { useMetadata } from '@builder.io/mitosis'; + +useMetadata({ + angular: { + nativeEvents: ['onNativeEvent'], + }, +}); + +export default function MyComponent(props) { + return ( +
+ console.log(event)} /> + Hello! +
+ ); +} +``` diff --git a/packages/core/src/__tests__/__snapshots__/alpine.test.ts.snap b/packages/core/src/__tests__/__snapshots__/alpine.test.ts.snap index 435fd037c3..b9ce030602 100644 --- a/packages/core/src/__tests__/__snapshots__/alpine.test.ts.snap +++ b/packages/core/src/__tests__/__snapshots__/alpine.test.ts.snap @@ -5821,7 +5821,7 @@ exports[`Alpine.js > jsx > Typescript Test > signalsOnUpdate 1`] = `
- +
-
{id}{$foo.bar.baz}
+
{id}{foo.value.bar.baz}