Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

How to fix IE 11 String.prototype.includes error in Ember?

$
0
0

@Jeffrey_Cheung wrote:

I am doing this in my controller/application.js:

  init(){
    if (!String.prototype.includes) {
      String.prototype.includes = function(search, start) {
        if (typeof start !== 'number') {
          start = 0;
        }
        if (start + search.length > this.length) {
          return false;
        } else {
          return this.indexOf(search, start) !== -1;
        }
      };
    }
  },

Even though it fixes the problem, it looks a really bad hack to me. How would you fix this properly?

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles