如何在 html 中使用 angular js 作用域变量

how to use angular js scope variable in html

我想在 html window.open 中传递从控制器返回的范围变量的值,但问题是我得到了一些垃圾值,请参阅下面的代码。

<header>
    <span class="item-title">{{x.name}}</span>
    <span class="list-item-note-sendmoney1" onclick="window.open('tel:{{x.phone}}', '_system')"><ons-icon icon="ion-android-call"></ons-icon></span>
</header>
<p class="swipe-item-desc">{{x.phone}}</p>

我想将 {{x.phone}} 传递给 window.open('tel:') 函数。

不要使用onclick。使用 ng-click。并将JS代码放入controller中:

ng-click="openWindow()"

并在控制器中

$scope.openWindow = function() {
    window.open('tel:' + $scope.x.phone, '_system');
}