Edit on

<div class="container" ng-app="dApp" ng-controller="dctrl">
<div class="col-sm-8 col-sm-offset-2">
  <div class="page-header"><h1>Apply classes in angularJS using string syntax</h1></div>
    <div class="form-group">
        <label>Button class name (enter some bootstrap classes name like : danger, success, warning etc.)</label>
        <input type="text" ng-model="btnClass" class="form-control">
    </div>
        <div ng-class="btnClass">Using ng-class</div>
  </div>
</div>
.danger{
    	background-color: red;
    }
    .success{
    	background-color: green;
    }
var app = angular.module('dApp', []);
app.controller('dctrl', function($scope){
  $scope.btnClass = "danger";
});
Rerun