gpt4 book ai didi

javascript - AngularJS - Textarea 在 ng-click 后不想清除

转载 作者:行者123 更新时间:2023-11-30 15:30:33 24 4
gpt4 key购买 nike

我的文本区域有问题。

当我想用 ng-click 清除她时,没有任何反应......

你能帮帮我吗?

这是我的代码,你可以用 Jsfiddle 测试:My app

如果你喜欢在这里看到它:

HTML:

<div ng-controller="Ctrl1">
<div><textarea id="yourid" ng-model="isWriting" ng-change="writeEvent(isWriting)"></textarea>
<span ng-if="displaySend == 1">Yann says :</span> {{isWriting}}
<p ng-click="sendYaah(isWriting); isWriting == ''">YAH!</p>
</div>

JS:

$scope.writeEvent = function(isWriting) {

$scope.imWriting = isWriting;
var empty = "";

if ($scope.imWriting != empty){
$scope.displaySend = 1;
// $scope.waitResponse = true;
} else {
$scope.displaySend = 0;
// $scope.waitResponse = false;
}

}

感谢帮助!

最佳答案

ng-click 中将 ==(equality operator) 更改为 =(assignment operator)

isWriting == ''

isWriting = ''

Forked Fiddle

关于javascript - AngularJS - Textarea 在 ng-click 后不想清除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42316349/

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