Change button color after click in Angularjs

前端 未结 3 1134
梦如初夏
梦如初夏 2021-01-20 16:39

This is what I have now: index.html

Todo

3条回答
  •  粉色の甜心
    2021-01-20 17:17

    The probably best way is to bind the button style to the variable like this:

    
    

    and define buttonStyle and buttonText in your scope

    $scope.buttonText = "Start";
    $scope.buttonStyle="button-calm";
    
    $scope.start = function(){
        $scope.buttonText = "Clicked!";
        $scope.buttonStyle="button-assertive";
    }
    

提交回复
热议问题