I have the following code where I am using the arrow functions to get my work done. This works perfectly in Chrome and Firefox as they support arrow functions.
this._subscription = this._modal.shown.subscribe(
() => this._el.nativeElement.focus());
But, this doesn't work properly in IE 11. So, I am trying to convert this arrow function into an anonymous self invoking function. I did the following:
this._subscription = this._modal.shown.subscribe(
(function(){ this._el.nativeElement.focus()})());
But the above code isn't working. Am I doing something wrong? How can I do this. Any suggestions and help would be appreciated.
()at the end in(function(){ ... })()so the anonymous function is not invoked. In your first code snippet you are giving the function reference and not calling it.()– there is no need to make an IIFE at all, just write a regular function expression. That is all.