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