admin管理员组

文章数量:1333201

"TypeError: Object doesn´t support this actionundefined" That´s the message in IE8´s console when I try to execute my angular app. And Angular doesn´t execute anything that it should. Anybody would have a tip to solve this issue? I have already included json2 and ui-ieshiv. I have also written html tag in this way:

<html xmlns:ng="" class="ng-app:app" ng-app="app" id="ng-app">

All the best!

"TypeError: Object doesn´t support this actionundefined" That´s the message in IE8´s console when I try to execute my angular app. And Angular doesn´t execute anything that it should. Anybody would have a tip to solve this issue? I have already included json2 and ui-ieshiv. I have also written html tag in this way:

<html xmlns:ng="http://angularjs" class="ng-app:app" ng-app="app" id="ng-app">

All the best!

Share Improve this question edited Aug 23, 2013 at 20:39 Jonathan Lonowski 124k34 gold badges202 silver badges202 bronze badges asked Aug 23, 2013 at 20:36 Yuri CamaraYuri Camara 11 silver badge1 bronze badge 3
  • According to the interweb, ie8 is deprecated. – Travis J Commented Aug 23, 2013 at 20:38
  • Well, it's rather difficult to help with code we can't see. Can you share some of it? – Jonathan Lonowski Commented Aug 23, 2013 at 20:38
  • No,Jonathan. I can´t show it now because of mercials questions. – Yuri Camara Commented Aug 23, 2013 at 20:47
Add a ment  | 

2 Answers 2

Reset to default 9

There were 3 things that IE8 didn't like when I ran my angular app in it.

1)The console.log function. I had to put this javascript in the page before angular is bootstrapped:

// Avoid `console` errors in browsers that lack a console.
            (function() {
                var method;
                var noop = function () {};
                var methods = [
                    'assert', 'clear', 'count', 'debug', 'dir', 'dirxml', 'error',
                    'exception', 'group', 'groupCollapsed', 'groupEnd', 'info', 'log',
                    'markTimeline', 'profile', 'profileEnd', 'table', 'time', 'timeEnd',
                    'timeStamp', 'trace', 'warn'
                ];
                var length = methods.length;
                var console = (window.console = window.console || {});

                while (length--) {
                    method = methods[length];

                    // Only stub undefined methods.
                    if (!console[method]) {
                        console[method] = noop;
                    }
                }
            }());

2) The toISOString function

 /*IE8 toISOString hack */
            if (!Date.prototype.toISOString) {
                Date.prototype.toISOString = function() {
                    function pad(n) { return n < 10 ? '0' + n : n }
                    return this.getUTCFullYear() + '-'
                        + pad(this.getUTCMonth() + 1) + '-'
                        + pad(this.getUTCDate()) + 'T'
                        + pad(this.getUTCHours()) + ':'
                        + pad(this.getUTCMinutes()) + ':'
                        + pad(this.getUTCSeconds()) + '.'
                        + pad(this.getUTCMilliseconds()) + 'Z';
                };
            }

3) The forEach function

  /*IE8 hack to support forEach */
            if (!Array.prototype.forEach) {
              Array.prototype.forEach = function(fn, scope) {
                for(var i = 0, len = this.length; i < len; ++i) {
                  fn.call(scope, this[i], i, this);
                }
              }
            }

Note that I didn't write any of this myself.. I 'mined' it from SO.

These were the culprits that I had to fix in order to run in IE8. Now, it works fine.

Problem was solved! I found an issue between IE8 and the plugin Angular-Restful. When I took it away, my app work back again.

本文标签: