我有一个输入和一个按钮
<input type="text" name="search_tags" id="search_tags" placeholder="Search by Tags" class="form-control" >
<button type="submit" class="btn btn-primary btn-lg" ng-click="searchTags()">Search</button>
如何在单击按钮后将输入文本框中的文本传递给 searchTags() 函数?
最佳答案
设置ngModel
指令与 input
控件,然后将其传递给按钮的 ngClick
。
<input type="text" ng-model="myText">
<button type="submit" ng-click="searchTags(myText)">Search</button>
myText
属性将可以在 $scope
中访问
关于javascript - 在 ng-click 上发送文本框输入,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37788985/