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

ng:change broken on 10.5 #692

Closed
ProLoser opened this issue Dec 16, 2011 · 12 comments
Closed

ng:change broken on 10.5 #692

ProLoser opened this issue Dec 16, 2011 · 12 comments

Comments

@ProLoser
Copy link
Contributor

Unless I'm just not using the proper syntax?

http://jsfiddle.net/ProLoser/TeU4Y/

@narisipalli
Copy link

The link given for the code is invalid. Results in HTTP 404.

@lanterndev
Copy link
Contributor

Thought I might have hit this myself, but got a very simple example working easily: http://jsfiddle.net/pants/pGgCG/
If I can reproduce anything possibly broken I'll update the ticket, and maybe Dean ("ProLoser") can do the same.

@lanterndev
Copy link
Contributor

(One weird thing in my example is initially neither radio button is checked, even though their ng:model's both point at the same boolean field, and one's value is {{true}} and the other's is {{false}}. It corrects itself once you click one of them. Is this a bug?)

@IgorMinar
Copy link
Contributor

works for me: http://jsfiddle.net/IgorMinar/pGgCG/14/

@lanterndev
Copy link
Contributor

@IgorMinar Yours exhibits the same behavior. The "not bar" radio button is not selected initially, despite having its "value" attribute match the value of the model variable it's bound to. (Maybe this belongs in a separate issue?)

@ProLoser
Copy link
Contributor Author

@pants: false !== 'false'

Wrap the value in quotes, the value defined in the view is considered a string.

Sent via Hubroid

@IgorMinar
Copy link
Contributor

@pants we don't initialize the model from the "value" attr. this is a tough decision we made in 0.10.x, there has been some discussion about it on the mailing list recently with a proposed 3rd party directive that initializes the model.

@lanterndev
Copy link
Contributor

@IgorMinar Thanks for the reply. The fiddle in question isn't trying to initialize the model via the "value" attr; it's happy to initialize bar in the controller. It's just trying to get the currently selected radio button to be in sync with the model from the start. Based on http://jsfiddle.net/vojtajina/MkwNu/2/ it looks like this should be possible, no? Is there no way to modify your http://jsfiddle.net/IgorMinar/pGgCG/14/ to fix this?

I looked on the mailing list for the thread you're referring to and couldn't find it. If you could link to it, I'd love to catch up on it.

Can you confirm whether @ProLoser's comment is true? I would think {{false}} would not be turned into 'false'.

Sorry to derail this ticket. Happy to move discussion elsewhere if appropriate.

@IgorMinar
Copy link
Contributor

@pants: I talked with @vojtajina and he's currently working on a fix that will address these the input[type=radio] issues.

the current limitation is that radio buttons can be bound only to models of type string, so if in your fiddle you change the link in the controller that assigns scope.bar = false to scope.bar = 'false' then the radio button will be initialized properly. this is silly and we think we know how to address it.

@vojtajina do we have a issue for this radio button change? can you post it here?

@IgorMinar
Copy link
Contributor

@pants the mailing list thread was discussing something unrelated.

@lanterndev
Copy link
Contributor

Thanks @IgorMinar, the 'false' hack indeed "fixed" it: http://jsfiddle.net/pGgCG/24/. Looking forward to following your progress.

@vojtajina
Copy link
Contributor

Here is the issue #816

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants