lakshay lakshay - 1 year ago 85
AngularJS Question

How to use onClick with angularJs?

I have written a condition

onclick="{{video_call_url}}, '_system', 'location=yes'); return false;"

is definded in myController as
$scope.video_call_url = '';

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

Answer Source

You can do the logic in the controller:

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

And in your view

<a ng-click="openVideoCallUrl()">Open!</a>
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download