"Change style Dynamically through angular js"
Bootstrap 3.3.0 Snippet by annilshinde

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <!------ Include the above in your HEAD tag ----------> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script> <div class="container" ng-app="myApp" ng-controller="myCtrl"> <div class="panel panel-primary"> <div class="panel-heading"> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12"> <h1 class="text-center">Change style Dynamically through angular js</h1> </div> </div> </div> <div class="panel-body"> <div class="row"> <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12"> <input class="form-control" onclick="this.focus();this.select()" ng-model="name" placeholder="Color name.."> </div> <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12"> <input class="form-control" type="number" ng-model="padding" placeholder="Padding.."> </div> <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12"> <input class="form-control" type="number" ng-model="fontSize" placeholder="Font Size"> </div> <div class="col-lg-3 col-md-3 col-sm-6 col-xs-12"> <input class="form-control" type="number" ng-model="curve" placeholder="Curve"> </div> </div> <div class="row"> <div class="col-lg-6 col-lg-offset-3 col-md-8 col-sm-12 col-xs-12"> <h1 style="text-align:center; color:{{name}}; border:2px solid #333; border-radius:{{curve}}px; padding:{{padding}}px; font-size:{{fontSize}}px;"> My color is {{name}} </h1> </div> </div> <div class="row"> <div class="col-lg-12 col-md-12 col-sm-12 col-xs-12 text-center"> <p>When you type value in the input field, the changes will affect the style</p> </div> </div> </div> </div> </div> <script> var app = angular.module('myApp', []); app.controller('myCtrl', function($scope) { $scope.name = "Black"; }); </script>
/***no additional css req...***/
/***no extra javascript req.***/

Related: See More


Questions / Comments: