【发布时间】:2014-09-27 15:07:22
【问题描述】:
我使用 angular bootstrap ui tabset 创建了两个选项卡,两个选项卡都有 textareas 与 ng-model 关联,我在 tabset 之外有一个清除按钮,我想清除 @987654325当用户按下清除按钮时,textArea 在活动选项卡中的@。做这个的最好方式是什么?这就是我到目前为止所做的。
HTML
<tabset>
<tab heading="Tab One">
<textarea data-ng-model="data.tabOne" class="form-control"></textarea>
</tab>
<tab heading="Tab two">
<textarea data-ng-model="data.tabOne" class="form-control"></textarea>
</tab>
</tabset>
<button ng-click="clearFn()" class="btn btn-default btn-float-left">Clear</button>
控制器
.controller('myController', ['$scope', function ($scope) {
$scope.data = {
tabOne: '',
tabTwo: ''
};
$scope.ClearFn = function () {
// I want to clear the model of the active tabs textArea here.
};
}]);
【问题讨论】:
标签: javascript html angularjs angularjs-directive angular-ui-bootstrap