all files / app/main/components/material-docs/demo-partials/colors/demoThemePicker/ script.js

4.76% Statements 1/21
0% Branches 0/4
0% Functions 0/7
4.76% Lines 1/21
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54                                                                                                          
angular
  .module('colorsThemePickerDemo', ['ngMaterial'])
  .controller('ThemeDemoCtrl', function ($scope, $mdColorPalette) {
    $scope.colors = Object.keys($mdColorPalette); 
 
    $scope.mdURL = 'https://www.google.com/design/spec/style/color.html#color-color-palette';
    $scope.primary = 'purple';
    $scope.accent = 'green';
 
    $scope.isPrimary = true;
 
    $scope.selectTheme = function (color) {
      if ($scope.isPrimary) {
        $scope.primary = color;
 
        $scope.isPrimary = false;
      }
      else {
        $scope.accent = color;
 
        $scope.isPrimary = true;
      }
    };
  })
  .directive('themePreview', function () {
    return {
      restrict: 'E',
      templateUrl: 'themePreview.tmpl.html',
      scope: {
        primary: '=',
        accent: '='
      },
      controller: function ($scope, $mdColors, $mdColorUtil) {
        $scope.getColor = function (color) {
          return $mdColorUtil.rgbaToHex($mdColors.getThemeColor(color))
        };
      }
    }
  })
  .directive('mdJustified', function() {
    return {
      restrict : 'A',
      compile : function(element, attrs)  {
        var layoutDirection = 'layout-'+ (attrs.mdJustified || "row");
 
        element.removeAttr('md-justified');
        element.addClass(layoutDirection);
        element.addClass("layout-align-space-between-stretch");
 
        return angular.noop;
      }
    };
  });