Skip to content
This repository has been archived by the owner on Apr 13, 2022. It is now read-only.

input[checkbox] doesn't catch checked in scope directive #13767

Closed
reivaxm opened this issue Jan 14, 2016 · 9 comments
Closed

input[checkbox] doesn't catch checked in scope directive #13767

reivaxm opened this issue Jan 14, 2016 · 9 comments

Comments

@reivaxm
Copy link

reivaxm commented Jan 14, 2016

The attribute "checked" is not recovered in the scope of a directive.
This seems broken since version 1.4.4
https://plnkr.co/edit/0j7Y9mkeP4m2waCLYLxU?p=preview
Working on 1.3.15
https://plnkr.co/edit/GN4K5EdtfHxPpe7x3OCc?p=preview

@Narretz
Copy link
Contributor

Narretz commented Jan 14, 2016

Seems to have been caused by 6f3b862 in combination with replace: true (if you remove replace, it works). Since replace is deprecated, I wouldn't hold out for a fix. If you want to provide a PR that fixes it, I'll be happy to take a look.

@Narretz
Copy link
Contributor

Narretz commented Jan 14, 2016

Oh, i also works if you use a different name for the checked attribute: https://plnkr.co/edit/yHiTck5stWNkhASsWA7t?p=preview
It's possible that checked is somehow special cased by the browser.

@petebacondarwin
Copy link
Member

The problem is that checked is a BOOLEAN attribute and Angular is converting it to a boolean value rather than leaving it as a string...

@petebacondarwin petebacondarwin self-assigned this Jan 14, 2016
@petebacondarwin petebacondarwin modified the milestones: 1.4.9, Ice Box Jan 14, 2016
@petebacondarwin
Copy link
Member

This is the relevant commit: 8a1eb16

@petebacondarwin
Copy link
Member

So since we always convert boolean attributes to a boolean value, you cannot use interpolation inside them as this will always be converted to true.
A simple workaround for you @reivaxm is to use $attr in your link function and write out the scope property manually... https://plnkr.co/edit/F6s1b50tHxsl5DQkeNlw?p=preview
But I have a basic fix coming anyway...

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 14, 2016
@Narretz
Copy link
Contributor

Narretz commented Jan 14, 2016

Ah, I was looking for this previous commit. Note that the plnkr only fails once you go to 1.4.4, though.

@petebacondarwin
Copy link
Member

Well this commit was part of a bit of reverting and unreverting work at the time so it is not exactly clear where it appears

@petebacondarwin
Copy link
Member

Here is the fix #13769
Can you take a look @Narretz ?

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 14, 2016
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 14, 2016
@petebacondarwin petebacondarwin modified the milestones: 1.5.0-rc.1, 1.4.9 Jan 14, 2016
@reivaxm
Copy link
Author

reivaxm commented Jan 14, 2016

Thanks a lot for your reactivity, the fix and globally for your work. I'll try that tomorrow.

petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 19, 2016
petebacondarwin added a commit to petebacondarwin/angular.js that referenced this issue Jan 20, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants