Angular4 views are accumulating in Internet Explorer 11

Viewed 865

I'm having a problem with Angular4 (currently 4.4.6), not in Chrome or Firefox or Edge, but in Internet Explorer 11. When I navigate through the application the new view is loaded, but when I scroll down the old views are still visible. After reloading the application, only the last view is shown.

Two errors are thrown in the console. It's probably just me, but I can't get any information from these errors:

    ERROR Error: Invalid argument.
   "ERROR"
   {
      [functions]: ,
      __proto__: { },
      description: "Invalid argument.",
      message: "Invalid argument.",
      name: "Error",
      ngDebugContext: { },
      number: -2147024809,
      stack: "Error: Invalid argument.
   at DefaultDomRenderer2.prototype.setValue (eval code:2950:71)
   at BaseAnimationRenderer.prototype.setValue (eval code:502:73)
   at DebugRenderer2.prototype.setValue (eval code:13972:66)
   at checkAndUpdateTextInline (eval code:12037:9)
   at checkAndUpdateNodeInline (eval code:12539:13)
   at checkAndUpdateNode (eval code:12484:9)
   at debugCheckAndUpdateNode (eval code:13341:5)
   at debugCheckRenderNodeFn (eval code:13320:13)
   at Anonymous function (Function code:53:5)
   at debugUpdateRenderer (eval code:13305:5)",
      Symbol(rxSubscriber)_m.xriwebaozwe: undefined
   }
   ERROR CONTEXT [object Object]
   "ERROR CONTEXT"
   {
      [functions]: ,
      __proto__: { },
      component: { },
      componentRenderElement: { },
      context: { },
      elDef: { },
      elOrCompView: { },
      elView: { },
      injector: { },
      nodeDef: { },
      nodeIndex: 13,
      providerTokens: [ ],
      references: { },
      renderNode: { },
      Symbol(rxSubscriber)_m.xriwebaozwe: undefined,
      view: { }
   }

Can somebody please tell me what to do except of telling the users to use a decent browser?

2 Answers

In my case, the following line was causing the problem.

<span [innerHTML]="getHtml()"></span>

The getHtml() method was returning a plain-string.

function getHtml() {
    return 'plain string'; //WRONG. It should return html like <p>Paragraph</p>
}
Related