Reputation: 1541
I want to add a scope variable as a argument for window.open function, i am using the following code.
onclick="window.open($scope.positionsURL, '_system', 'location=yes'); return false;"
I am getting the following error.
Uncaught ReferenceError: $scope is not defined
What am I missing? Do I have any syntax error? Please help me to solve this issue.
Upvotes: 1
Views: 547
Reputation: 28259
You should use ng-click
instead:
ng-click="open(positionsURL, '_system', 'location=yes')"
And define the function $scope.open
in the controller. Should be something like that:
$scope.open = function (url, name, spec) {
$window.open(url, name, spec); // don't forget to inject $window in the controller
return false;
}
Upvotes: 3