internet explorer - ngRepeat $index is not displaying properly in IE 9 -
the angular js docs ngrepeat directive supposed set $index variable item index in array. works fine in chrome , ie 10, ie 9 shows "{{$index}}" instead of number. here small example:
<!doctype html> <html> <head> <meta charset="utf-8"> <title>host parameters</title> <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular.js"></script> <style> .host-param-table { border-collapse: collapse; } .host-param-table td, .host-param-table th { border: 1px solid gray; text-align:center; padding: 2px; font-size: 15px; font-family: arial; } </style> </head> <body id="ng-app" data-ng-app> <div data-ng-controller="hostparametersctrl"> <table class="host-param-table"> <tr> <th>name</th> <th>index</th> <th>on</th> <th>value (hex)</th> <th>value (output)</th> </tr> <tr data-ng-repeat="p in params"> <td>{{p.name}}</td> <td>{{$index}}</td> <td><input data-ng-model="p.isenabled" type="checkbox" /></td> <td><input data-ng-model="p.value" data-ng-disabled="!p.isenabled" type="text" /></td> <td>0x{{p.value}}</td> </tr> </table> </div> <script type="text/javascript"> function hostparametersctrl($scope) { $scope.params = [ { 'isenabled': false, 'name': 'first', 'value': '' }, { 'isenabled': false, 'name': 'second', 'value': '' }, { 'isenabled': false, 'name': 'third', 'value': '' }, { 'isenabled': false, 'name': 'fourth', 'value': '' }, { 'isenabled': false, 'name': 'fifth', 'value': '' }, { 'isenabled': false, 'name': 'sixth', 'value': '' }, { 'isenabled': false, 'name': 'seventh', 'value': '' } ]; } </script> </body> </html>
viewed in chrome 29:
viewed in ie 9:
note checkboxes disable inputs expected. it's index that's broken. today first day using angular js i'm hoping there simple forgot , easy fix. doing wrong?
i created plunkr code here: http://plnkr.co/edit/ajhz04yqnbmkhuicwmgb?p=preview - modified bit.
when view same codebase on local pc using ie, runs same in ie8, 9 , 10. not run @ in ie7.
unfortunately, don't think plunkr supports ie8, or 9, paste code file , see if makes difference.
Comments
Post a Comment