Cannot enable disabled inputs in IE

1,929 views
Skip to first unread message

Petter

unread,
Dec 9, 2010, 6:18:17 AM12/9/10
to Angular
Hi,

I have been playing around with angular a bit. Seems really nice.

But, I have a problem with IE (where else) where inputs cannot be
enabled. In the following example neither the text box nor the button
will be enabled, regardless of the value of enabled. Same example
works fine in both Chrome and Firefox.

<!doctype html>
<html xmlns:ng="http://angularjs.org">
<script type="text/javascript" src="http://code.angularjs.org/
angular-0.9.6.js" ng:autobind></script>
<body>
<input type="text" name="name" disabled="{{!enabled}}" value="abc" /
>
<input type="checkbox" name="enabled" checked/>
<button ng:click="test()" disabled="{{!enabled}}">Test</button>
enabled={{enabled|json}}
</body>
</html>

I have tested this on two different IE setups (and it does not work
for either):
* Windows Vista with IE 8.0.6001.18975
* Windows XP SP3 with IE 7.0.5730.13

Misko Hevery

unread,
Dec 9, 2010, 3:37:50 PM12/9/10
to ang...@googlegroups.com
Hi Peter,

The IE strikes again! :-) You are correct, the issue is that IE does not preserve the value of the special attribute such as disabled, hence angular can not parse it!

code such as


<button ng:click="test()" disabled="{{!enabled}}">Test</button> 

does not work in IE, since it clobbers the value of this attribute. We should support
<button ng:click="test()" ng:disabled="{{!enabled}}">Test</button>
the current work around is:
<button ng:click="test()" ng:bind-attr="{disabled:'{{!enabled}}'};>Test</button>


Hope this helps

-- Misko



--
You received this message because you are subscribed to the Google Groups "Angular" group.
To post to this group, send email to ang...@googlegroups.com.
To unsubscribe from this group, send email to angular+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/angular?hl=en.


Reply all
Reply to author
Forward
0 new messages