To implement themes in application I create multiple css files with different styles like (red, green,blue).
Red.css
  1. body
  2. {
  3. font-family: "Source Sans Pro",Calibri,Candara,Arial,sans-serif;
  4. font-size: 15px;
  5. line-height: 1.42857143;
  6. color: #333333;
  7. background-color: red;
  8. }
Blue.css
  1. body
  2. {
  3. font-family: "Source Sans Pro",Calibri,Candara,Arial,sans-serif;
  4. font-size: 15px;
  5. line-height: 1.42857143;
  6. color: wheat;
  7. background-color: blue;
  8. }
Green.css
  1. body
  2. {
  3. font-family: "Source Sans Pro",Calibri,Candara,Arial,sans-serif;
  4. font-size: 15px;
  5. line-height: 1.42857143;
  6. color: chartreuse;
  7. background-color: green;
  8. }
Then I create an app.js file for AngularJS, in which I declare my Angular module and controller.
  1. angular.module('ThemeApp', [])
  2. .controller('mainController', function ($scope) {
  3. // set the default theme
  4. $scope.css = 'Red';
  5. // create the list of themes
  6. $scope.bootstraps = [
  7. { name: 'Red', url: 'Red' },
  8. { name: 'Blue', url: 'Blue' },
  9. { name: 'Green', url: 'Green' }
  10. ];
  11. });
In the above code I declare a module "ThemeApp" and then attach a controller with this module. In the controller I declare an object array with all available theme that implements my application. I set one of theme by default for application for the first time.
Now, moving to HTML Page.
  1. <html ng-app="ThemeApp" ng-controller="mainController">
  2. <head>
  3. <script src="Scripts/angular.min.js"></script>
  4. <!-- pull in css based on angular -->
  5. <link rel="stylesheet" ng-href="{{css}}.css">
  6. <!-- bring in JS and angular -->
  7. <script src="CustomJS/app.js"></script>

  8. </head>
  9. <body>
  10. <div >
  11. <form>
  12. <div >
  13. <h1> <label>Select Theme</label></h1>
  14. <select ng-model="css" ng-options="bootstrap.url as bootstrap.name for bootstrap in bootstraps">
  15. </select>
  16. </div>
  17. </form>
  18. </div>
  19. </body>
  20. </html>
Your output will looks like this


So, We can exactly see how it works. We are pulling our own custom css file dynamically with ng-Href directive in AngularJS.