Skip to content

feat(NgxControlValueAccessor): add possibility to transform model values#636

Open
RobbyRabbitman wants to merge 2 commits intongxtension:mainfrom
RobbyRabbitman:feat/NgxControlValueAccessor-model-transform
Open

feat(NgxControlValueAccessor): add possibility to transform model values#636
RobbyRabbitman wants to merge 2 commits intongxtension:mainfrom
RobbyRabbitman:feat/NgxControlValueAccessor-model-transform

Conversation

@RobbyRabbitman
Copy link
Copy Markdown
Contributor

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello @RobbyRabbitman, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a significant enhancement to the NgxControlValueAccessor by adding a transform function. This new capability allows developers to define custom logic for modifying model values as they are passed into the control, providing a powerful way to format, sanitize, or otherwise process data. The feature is supported by a new injection token for global configuration, a practical demonstration in the test application, and thorough documentation updates to ensure ease of adoption.

Highlights

  • New transform function: Introduced a new transform function within NgxControlValueAccessor that allows intercepting and modifying incoming model values before they are set in the control.
  • Configurable Transformation: The transform function can be set directly on the NgxControlValueAccessor instance or provided globally using the new provideCvaTransform utility, offering flexible configuration.
  • Core Logic Integration: The initialValue and writeValue methods of NgxControlValueAccessor have been updated to apply the transform function, ensuring consistent value manipulation.
  • Demonstration and Testing: A new CustomInputWithTransform component was added to the test application to visually demonstrate the feature, alongside comprehensive unit tests covering default behavior, instance-level, and provider-based transformations.
  • Documentation Updates: Both English and Spanish documentation for NgxControlValueAccessor have been updated with a new section explaining how to use the transform functionality, including code examples.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a transform function to NgxControlValueAccessor, allowing for the transformation of incoming model values. The implementation is clean, and the core logic is well-tested. My review includes suggestions to improve the example code in the test application and to correct some issues in the documentation, such as a typo and an example that would fail with strict template checking.

robert hasemann added 2 commits December 14, 2025 21:30
@eneajaho eneajaho force-pushed the feat/NgxControlValueAccessor-model-transform branch from 6b3aa04 to 2c2ba41 Compare December 15, 2025 02:30
@nx-cloud
Copy link
Copy Markdown

nx-cloud bot commented Dec 15, 2025

🤖 Nx Cloud AI Fix Eligible

An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

To disable these notifications, a workspace admin can disable them in workspace settings.


View your CI Pipeline Execution ↗ for commit 2c2ba41

Command Status Duration Result
nx affected --target=test --parallel=3 --exclud... ❌ Failed 16s View ↗
nx affected --target=lint --parallel=3 ✅ Succeeded 36s View ↗
nx-cloud record -- nx format:check ✅ Succeeded 2s View ↗

☁️ Nx Cloud last updated this comment at 2025-12-15 02:32:25 UTC

@eneajaho
Copy link
Copy Markdown
Collaborator

@RobbyRabbitman looks like the CI doesn't pass. Can you look into it please? If we can make it pass we can merge I guess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants