Improve this Doc

Error: $parse:isecwindow
Referencing Window object in Expression

Referencing the Window in Angular expressions is disallowed! Expression: {0}

Description

Occurs when an expression attempts to access a Window object.

AngularJS restricts access to the Window object from within expressions since it's a known way to execute arbitrary Javascript code.

This check is only performed on object index and function calls in Angular expressions. These are places that are harder for the developer to guard. Dotted member access (such as a.b.c) does not perform this check - it's up to the developer to not expose such sensitive and powerful objects directly on the scope chain.

To resolve this error, avoid Window access.

Common CoffeeScript Issue

Be aware that if you are using CoffeeScript, it automatically returns the value of the last statement in a function. So for instance

scope.foo = ->
  window.open 'https://example.com'

compiles to something like

scope.foo = function() {
  return window.open('https://example.com');
};

You can see that this function will return the result of calling window.open, which is a Window object.

You can avoid this by explicitly returning something else from the function:

scope.foo = ->
  window.open 'https://example.com'
  return true;