这里我使用此代码启用和取消单击编辑按钮时的文本框。 但在这里我想要的是点击EDIT按钮,按钮的文本应该更改为UPDATE
**CODE**
<input type="text" input-disabled="editableInput" />
<button ng-click="editableInput = !editableInput">EDIT</button>
app.controller("myController", function(){
$scope.editableInput = false;
});
app.directive("inputDisabled", function(){
return function(scope, element, attrs){
scope.$watch(attrs.inputDisabled, function(val){
if(val)
element.removeAttr("disabled");
else
element.attr("disabled", "disabled");
});
}
});
我尽我所能,有人帮助我。
答案 0 :(得分:1)
怎么样:
<button ng-click="editableInput = !editableInput">
<span ng-show="editableInput">UPDATE</span>
<span ng-show="!editableInput">EDIT</span>
</button>