我写了条件
onclick="window.open({{video_call_url}}, '_system', 'location=yes'); return false;"
此处video_call_url
在myController中定义为$scope.video_call_url = 'http://www.google.com/';
但是当我点击按钮时,我收到错误video_call_url is not defined.
答案 0 :(得分:5)
您可以在控制器中执行逻辑:
function myController($scope, $window) {
$scope.openVideoCallUrl = function() {
$window.open($scope.video_call_url, "_system", "location=yes");
return false;
}
}
在你看来
<a ng-click="openVideoCallUrl()">Open!</a>
答案 1 :(得分:1)
您可以使用ng-click
,而不是使用onclick
ng-click="open(video_call_url)"
$scope.open = function(url) {
//inject $window inside controller.
$window.open(url, '_system', 'location=yes');
return false;
}