6

I have written a condition

onclick="window.open({{video_call_url}}, '_system', 'location=yes'); return false;"

here video_call_url is definded in myController as $scope.video_call_url = 'http://www.google.com/';

but when i click the button i am getting an error video_call_url is not defined.

3
  • have u inject $scope in controller ? Commented Nov 4, 2016 at 11:45
  • yes....................... Commented Nov 4, 2016 at 11:46
  • check whether you declare method with correct syntax or not Commented Nov 4, 2016 at 11:47

2 Answers 2

8

You can do the logic in the controller:

function myController($scope, $window) {
    $scope.openVideoCallUrl = function() {
        $window.open($scope.video_call_url, "_system", "location=yes");
        return false;
    }
}

And in your view

<a ng-click="openVideoCallUrl()">Open!</a>
Sign up to request clarification or add additional context in comments.

Comments

3

You could use ng-click, instead of using onclick

ng-click="open(video_call_url)"

$scope.open = function(url) {
  //inject $window inside controller.
  $window.open(url, '_system', 'location=yes');
  return false;
}

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.