i399exng1comp/app/switch.cmp.js

30 lines
538 B
JavaScript

(function () {
'use strict';
var options = {
templateUrl: 'app/switch.cmp.html',
controller: Controller,
bindings: {
isOn: '<initial',
onChange: '<'
}
};
function Controller() {
this.$onInit = $onInit;
this.toggle = toggle;
function $onInit() {
}
function toggle() {
this.isOn = !this.isOn;
this.onChange(this.isOn);
}
}
angular.module('app').component('switch', options);
})();