[英]How to set a value to an input text element of a stateless function inside a Jest test
[英]angularjs how to set text inside element based on textbox input
我的代碼是:
<div ng-controller="myCtrl">
<div class="row">
<div class="col-md-4 col-sm-3">
<checked-input ng-scope="$eventID"></checked-input>
</div>
<div class="col-md-4 col-sm-3">
<output ng-scope="$postbackOutput">***This is where I want the text typed in the textbox to go***</output>
</div>
<div class="col-md-3 col-sm-3">
<a ng-click="generateURL($eventID)" class="btn-plus">
<span class="glyphicon glyphicon-plus"></span>
</a>
</div>
</div>
</div>
所以我想做的是獲取第一列div內的$eventID
,然后在第三列中單擊<a>
標記中的鏈接時,將其作為參數傳遞給函數調用generateURL()
。 在控制器內部,我有:
app.controller('postbackCtrl', function($scope) {
$scope.generateURL = function(eventID) {
$scope.postbackOutput = eventID;
}
});
但是它似乎無法正確設置<output>
的文本。 有人可以幫忙嗎? 我剛開始使用angular,所以有點混亂。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.