How to use data in the repeater in ng-disabled?

1,157 views
Skip to first unread message

Thai

unread,
Sep 13, 2013, 10:42:02 AM9/13/13
to ang...@googlegroups.com
Hi All,

I have this page running in IE 8 in Compatibility View mode:

<!DOCTYPE html>
<html>
<head>
    <style type="text/css">
        body { color: #444; font-family: sans-serif; line-height: 1.41em; }
    </style>
    <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/json2/20121008/json2.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/angularjs/1.0.8/angular.min.js"></script>
    <script type="text/javascript">
        var data = [
            {a: 1, b: 2, c: true},
            {a: 3, b: 4, c: false}
        ];

        function UniqueController($scope) {
            $scope.data = [];

            $scope.getData = function() {
                $scope.data = data;
            };
        }

        angular.module("myApp", []);
    </script>
</head>
<body  id="ng-app" ng-app="myApp" ng-controller="UniqueController">
    <button ng-click="getData()">Get Data</button>
    <table>
        <tr><td>a</td><td>b</td><td>radio button</td></tr>
        <tr ng-repeat="d in data">
            <td>{{d.a}}</td>
            <td>{{d.b}}</td>
            <td><input type="radio" name="myradio" ng-disabled="d.c"/></td>
        </tr>
    </table>
</body>
</html>

I want to have the radio button on a row disabled if the value of c on that row is true. However it doesn't work that way.

I think this issue was asked before but I couldn't find it (maybe I used the wrong keyword to search).

Regards.

William Szeliga

unread,
Sep 13, 2013, 10:49:47 AM9/13/13
to ang...@googlegroups.com
Sorry if this is incorrect, but would changing the ng-disabled attribute from ng-disabled="d.c" to ng-disabled="{{d.c}}" work for you?  (again this is just a quick "try this" / something that jumps out to me).

-Bill


--
You received this message because you are subscribed to the Google Groups "AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email to angular+u...@googlegroups.com.
To post to this group, send email to ang...@googlegroups.com.
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/groups/opt_out.

Thai

unread,
Sep 13, 2013, 11:26:49 AM9/13/13
to ang...@googlegroups.com
No, it doesn't.

Daniel Garcia Gil

unread,
Sep 13, 2013, 4:37:52 PM9/13/13
to ang...@googlegroups.com

Thai

unread,
Sep 13, 2013, 5:12:00 PM9/13/13
to ang...@googlegroups.com
Thank you very much. So the reason is that I have an old jQuery version on that page (1.3.2) and angularjs won't use its own jQuery but will use our jQuery if it's available.

The reason I have jquery there is that I want to mimic the real page that I'm working on.
Reply all
Reply to author
Forward
0 new messages