gpt4 book ai didi

angularjs - 如何在 angularJs 中使用 onClick?

转载 作者:行者123 更新时间:2023-12-04 23:16:26 24 4
gpt4 key购买 nike

我写了条件

onclick="window.open({{video_call_url}}, '_system', 'location=yes'); return false;"
这里 video_call_url在 Controller 中定义为 $scope.video_call_url = 'http://www.google.com/';但是当我点击按钮时,我收到一个错误 video_call_url is not defined.

最佳答案

您可以在 Controller 中执行逻辑:

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

在你看来
<a ng-click="openVideoCallUrl()">Open!</a>

关于angularjs - 如何在 angularJs 中使用 onClick?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40421822/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com