Skip to content

Instantly share code, notes, and snippets.

@DanFerrer
Created March 25, 2015 00:49
Show Gist options
  • Select an option

  • Save DanFerrer/e9e1f2c12c7c6bfd87d2 to your computer and use it in GitHub Desktop.

Select an option

Save DanFerrer/e9e1f2c12c7c6bfd87d2 to your computer and use it in GitHub Desktop.
Practice Bootstrap classes with AngularJS two way data binding
<!DOCTYPE html>
<html ng-app="sampleApp" lang="en">
<head>
<meta charset="UTF-8">
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.3.15/angular.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<link rel="stylesheet"href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap-theme.min.css">
<title>Practice With Bootstrap</title>
<script>
angular.module('sampleApp', []).controller('practiceController', function($scope) {
$scope.classNames = {
classNameOne: "Play with me :D",
classNameTwo: "Me too please D:",
classNameThree: "AND ME!! ^_^"
}
});
</script>
</head>
<body>
<div class="container">
<h1 class="page-header text-center">Pracitce bootstrap here</h1>
<div class="row">
<div ng-controller="practiceController" class="form-group">
<div class="col-md-4">
<input type="text" class="form-control" ng-model="classNames.classNameOne">
<div class="{{ classNames.classNameOne }}">{{classNames.classNameOne}}</div>
</div>
<div class="col-md-4">
<input type="text" class="form-control" ng-model="classNames.classNameTwo">
<div class="{{ classNames.classNameTwo }}">{{classNames.classNameTwo}}</div>
</div>
<div class="col-md-4">
<input type="text" class="form-control" ng-model="classNames.classNameThree">
<div class="{{ classNames.classNameThree }}">{{classNames.classNameThree}}</div>
</div>
</div>
</div>
</div>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment