我有一个文本框,其中输入了特定的内容,如果单击button........by,我将如何将文本框的内容移动到另一个文本框中,完全清空前一个文本框。
<div class="col-sm-5">
<p>Invite People</p>
<div class="invite-user-text">
<!-- <input type="text" class="invite-user-input" autocomplete="off"
data-keyboard-layer="invite-user-text" placeholder=""> -->
<tags-input ng-model="tags" display-property="name"
placeholder="Add User" replace-spaces-with-dashes="false">
<auto-complete source="loadCountries($query)" min-length="0"
load-on-focus="true" load-on-empty="true"
max-results-to-show="32" template="my-custom-template"></auto-complete>
</tags-input>
<script type="text/ng-template" id="my-custom-template">
<div class="right-panel">
<span ng-bind-html="$highlight($getDisplayText())"></span>
<span>{{data.email}}</span>
</div>
</script>我有上面的Html代码和一个js,通过在文本框中使用ng输入标记库来显示内容有标签……我想使用单击按钮的角度js将该内容(标记)移动到另一个文本框。
<button type="button" ng-click=""
class="btn btn-md pull-right add-user-btn" ng-disabled="">
Add Users</button>
</div>
</button>
<div class="col-sm-7 user-text-area">
<p>Deal Administrator</p>
</div>发布于 2017-03-21 07:48:25
您还可以在控制器中的一个函数中包装它:
<button type="button" ng-click="text=tags">然后你的文字输入:
<input type="text" ng-model="text">这将给您文本输入中的标签json。
编辑:
您可以看看这个完整的plunkr:https://plnkr.co/edit/1db1Af?p=preview
这就是如何获取标记的值:
$scope.moveTagsToTextInput = function(){
$scope.text = "";
angular.forEach($scope.tags, function(value, key) {
$scope.text += value.text + " ";
});
$scope.tags = "";
}https://stackoverflow.com/questions/42920788
复制相似问题