Skip to content

fix(compiler): Don't bind inputs/outputs for data- attributes#66315

Merged
thePunderWoman merged 1 commit intoangular:mainfrom
JeanMeche:compiler-data-binding
Feb 23, 2026
Merged

fix(compiler): Don't bind inputs/outputs for data- attributes#66315
thePunderWoman merged 1 commit intoangular:mainfrom
JeanMeche:compiler-data-binding

Conversation

@JeanMeche
Copy link
Member

@JeanMeche JeanMeche commented Jan 4, 2026

This is to improve consistency and match developer expectations.
This syntax was already deprecated a long time ago.
If you want to bind a data attribute, use the attr. prefix (which was already supported).

Examples like following will now produce a compilation error:

data-id="{{1}}"
data-[type]="'button'"

And should be replace by their respective input syntax (without the data- prefix)

BREAKING CHANGE: data prefixed attribute no-longer bind inputs nor outputs.

fixes #26406


What still works:

  • bind-foo="someProp" binds somProp to the foo input
  • on-foo="fooMethod()" will hook up a listener with fooMethod

@JeanMeche JeanMeche added target: major This PR is targeted for the next major release state: blocked on G3 cleanup This change requires a G3 cleanup labels Jan 4, 2026
@angular-robot angular-robot bot added detected: breaking change PR contains a commit with a breaking change area: compiler Issues related to `ngc`, Angular's template compiler labels Jan 4, 2026
@JeanMeche JeanMeche added this to the v22 candidates milestone Jan 4, 2026
@ngbot ngbot bot modified the milestones: v22 candidates, Backlog Jan 4, 2026
@JeanMeche JeanMeche modified the milestones: Backlog, v22 candidates Jan 5, 2026
@JeanMeche JeanMeche added breaking changes and removed detected: breaking change PR contains a commit with a breaking change state: blocked on G3 cleanup This change requires a G3 cleanup labels Jan 9, 2026
@JeanMeche
Copy link
Member Author

G3 has been cleaned-up.
Since this is a breaking change, we'll have to wait for the breaking change window of v22

@JeanMeche JeanMeche force-pushed the compiler-data-binding branch from 24820a9 to 0d65e85 Compare February 18, 2026 12:53
@angular-robot angular-robot bot added the detected: breaking change PR contains a commit with a breaking change label Feb 18, 2026
@JeanMeche JeanMeche marked this pull request as ready for review February 18, 2026 12:54
This is to improve consistency and match developer expectations. This syntax was already deprecated a long time ago.
If you want to bind a data attribute, use the `attr.` prefix (which was already supported).

BREAKING CHANGE: data prefixed attribute no-longer bind inputs nor outputs.

fixes angular#26406
@JeanMeche JeanMeche force-pushed the compiler-data-binding branch from 0d65e85 to e14969d Compare February 18, 2026 19:16
@JeanMeche
Copy link
Member Author

Green TGP

@JeanMeche JeanMeche added the action: merge The PR is ready for merge by the caretaker label Feb 20, 2026
@JeanMeche JeanMeche removed the request for review from crisbeto February 20, 2026 23:02
@thePunderWoman thePunderWoman merged commit 488d962 into angular:main Feb 23, 2026
20 checks passed
@thePunderWoman
Copy link
Contributor

This PR was merged into the repository. The changes were merged into the following branches:

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Mar 26, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler breaking changes detected: breaking change PR contains a commit with a breaking change target: major This PR is targeted for the next major release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

data- prefix gets stripped from bindings such as <div data-id="{{1}}">

3 participants