"Referencing the Window in Angular expressions is disallowed!"
How do we do a window.open now?
Error: [$parse:isecwindow] Referencing the Window in Angular expressions is disallowed! Expression: foo()
scope.foo = ->
window.open 'https://example.com'
I guess we should use the $window service.
http://docs.angularjs.org/api/ng.$window
But i'm getting the same error with $window
Put it in a controller function that you call from the expression in the template. Angular templates should not contain code like this directly On 10 Nov 2013 16:17, "Christian" [email protected] wrote:
I guess we should use the $window service.
http://docs.angularjs.org/api/ng.$window
But i'm getting the same error with $window
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/4853#issuecomment-28153758 .
:+1: For keeping calls like that out of a template.
On Sun, Nov 10, 2013 at 10:40 AM, Pete Bacon Darwin < [email protected]> wrote:
Put it in a controller function that you call from the expression in the template. Angular templates should not contain code like this directly On 10 Nov 2013 16:17, "Christian" [email protected] wrote:
I guess we should use the $window service.
http://docs.angularjs.org/api/ng.$window
But i'm getting the same error with $window
— Reply to this email directly or view it on GitHub< https://github.com/angular/angular.js/issues/4853#issuecomment-28153758> .
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/4853#issuecomment-28154215 .
Something like this
myMod.controller('MyCtrl', function($scope, $window) {
$scope.OpenWindow = function(...) {
$window.open(...);
};
});
If you are using coffeescript it's a problem caused by coffeescript habit of returning everything and in your case returns a "dom" object. Try something like:
scope.foo = -> window.open 'https://example.com' return true
Ahh that's it, I did solve it but I couldn't figure out why, thanks
On Friday, November 15, 2013, Adrian-Catalin Neatu wrote:
If you are using coffeescript it's a problem caused by coffeescript habit of returning everything and in your case returns a "dom" object. Try something like:
scope.foo = -> window.open 'https://example.com' return true
— Reply to this email directly or view it on GitHubhttps://github.com/angular/angular.js/issues/4853#issuecomment-28491586 .
+1 @w3apps that's what I was doing.
+1 @w3apps thank you so much!
+1 @w3apps thank you!
+1 @w3apps thanks, that solved my issue.
awesome. thanks
+1 w3apps
:+1: @w3apps
@w3apps thx for the help!
+1 @w3apps thank you!
+1 Thanks! @w3apps
+1 @w3apps
@xtang 哈哈 我也遇到这个问题了
+1 Thanks! @w3apps
+1 @w3apps