jtormey / angular-theme

Dynamic style and layout switching, powered by Angular

Home Page:http://jtormey.github.io/angular-theme

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Angular Theme

Dynamic style and layout switching using Angular

API

Loading Themes

<head>
  <link href="/light.css" ng-theme="light" default />
  <link href="/dark.css" ng-theme="dark" />
</head>

Attributes:

  • ng-theme - Tells angular-theme about the style, and gives it a name for future reference
  • default - Specifies the style to show on load

Programatic API

$themeProvider

  • setInitialTheme(themeName) - Sets the initial theme
angular.module('my.app', ['angular.theme']).config(function ($themeProvider) {
  // will override default theme
  $themeProvider.setInitialTheme('dark');
});

$theme

  • themes - Array of available theme names
  • activeTheme - Name of active theme
  • setTheme(themeName) - Sets the active theme
angular.module('my.app').controller('MyController', function ($scope, $theme) {
  $scope.theme = $theme.activeTheme;
  $scope.$watch('theme', $theme.setTheme);
});

License

MIT

About

Dynamic style and layout switching, powered by Angular

http://jtormey.github.io/angular-theme


Languages

Language:JavaScript 84.4%Language:HTML 14.0%Language:CSS 1.7%