1

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.

1 Answer 1

3

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;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.