i399exng1comp/app/switch.cmp.js

30 lines
538 B
JavaScript
Raw Permalink Normal View History

2017-04-26 09:23:53 +03:00
(function () {
'use strict';
var options = {
templateUrl: 'app/switch.cmp.html',
controller: Controller,
2017-05-11 09:20:07 +03:00
bindings: {
isOn: '<initial',
onChange: '<'
}
2017-04-26 09:23:53 +03:00
};
function Controller() {
this.$onInit = $onInit;
2017-05-11 09:20:07 +03:00
this.toggle = toggle;
2017-04-26 09:23:53 +03:00
function $onInit() {
}
2017-05-11 09:20:07 +03:00
function toggle() {
this.isOn = !this.isOn;
this.onChange(this.isOn);
}
2017-04-26 09:23:53 +03:00
}
angular.module('app').component('switch', options);
})();