AngularJs Change Button Text


AngularJs Change Button Text: There are many ways to change button text in angularjs. Here in this tutorial we are going to explain some of them. We will explain this with example and demo.


AngularJs Change Button Text / Label : ngclick Example

Here is simple example which changes button text / label on button click –

Html Part

AngularJs Change Button Text / Label Example :

<button ng-click="changeText()">{{btnText}}</button>

JavaScript Part

AngularJs Change Button Text / Label Example :

<script>
var myApp = angular.module("myApp", []);
 myApp.controller("myController", function($scope) {
 $scope.btnText = 'Add';
$scope.changeText = function() {
    $scope.btnText = 'Please Wait...';
};
});
</script> 

Try it »

The above example contains a button it’s default text label is “Add”. If you click on the button label will change to “Please Wait…”. If you run the above example it will produce the output something like this –

AngularJs Change Button Text / Label Example :


Advertisements

Add Comment

📖 Read More