mirror of https://github.com/akveo/blur-admin
fix(demo): updated demo for switcher component
parent
85181fd59d
commit
6c4f1b670b
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* @author v.lugovsky
|
||||
* created on 07.06.2016
|
||||
*/
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
angular.module('BlurAdmin.pages.form')
|
||||
.controller('SwitchPanelCtrl', SwitchPanelCtrl);
|
||||
|
||||
/** @ngInject */
|
||||
function SwitchPanelCtrl() {
|
||||
var vm = this;
|
||||
|
||||
vm.switcherValues = {
|
||||
primary: true,
|
||||
warning: true,
|
||||
danger: true,
|
||||
info: true,
|
||||
success: true
|
||||
};
|
||||
}
|
||||
|
||||
})();
|
|
@ -16,10 +16,11 @@
|
|||
scope: {
|
||||
ngModel: '='
|
||||
},
|
||||
template: '<div class="switch-container {{color}}"><input type="checkbox" ng-model="ngModel"></div>',
|
||||
template: function(el, attrs) {
|
||||
return '<div class="switch-container ' + (attrs.color || '') + '"><input type="checkbox" ng-model="ngModel"></div>';
|
||||
},
|
||||
link: function (scope, elem, attr) {
|
||||
$timeout(function(){
|
||||
scope.color = attr.color;
|
||||
var input = $(elem).find('input');
|
||||
input.bootstrapSwitch({
|
||||
size: 'small',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
<div ng-init="switches = [ true, true, true, true, true, true ]" class="switches clearfix">
|
||||
<switch color="primary" ng-model="switches[5]"></switch>
|
||||
<switch color="warning" ng-model="switches[1]"></switch>
|
||||
<switch color="danger" ng-model="switches[2]"></switch>
|
||||
<switch color="info" ng-model="switches[3]"></switch>
|
||||
<switch color="success" ng-model="switches[0]"></switch>
|
||||
<div ng-controller="SwitchPanelCtrl as switchPanelVm" class="switches clearfix">
|
||||
<switch color="primary" ng-model="switchPanelVm.switcherValues.primary"></switch>
|
||||
<switch color="warning" ng-model="switchPanelVm.switcherValues.warning"></switch>
|
||||
<switch color="danger" ng-model="switchPanelVm.switcherValues.danger"></switch>
|
||||
<switch color="info" ng-model="switchPanelVm.switcherValues.info"></switch>
|
||||
<switch color="success" ng-model="switchPanelVm.switcherValues.success"></switch>
|
||||
</div>
|
Loading…
Reference in New Issue