CARVIEW |
Select Language
HTTP/2 301
location: https://raw.githubusercontent.com/cgarvis/angular-toggle-switch/master/angular-toggle-switch.min.js
accept-ranges: bytes
age: 0
date: Sat, 26 Jul 2025 13:40:57 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210069-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753537257.785602,VS0,VE1187
vary: Accept-Encoding
x-fastly-request-id: 493df3a6030b4137a311cc2710b27488da3e96b5
content-length: 0
HTTP/2 200
cache-control: max-age=300
content-security-policy: default-src 'none'; style-src 'unsafe-inline'; sandbox
content-type: text/plain; charset=utf-8
etag: W/"5bc78f71319c0a105e8e208470f97d58f0b38c1ec25d28a329892a641da06880"
strict-transport-security: max-age=31536000
x-content-type-options: nosniff
x-frame-options: deny
x-xss-protection: 1; mode=block
x-github-request-id: 53B2:E401A:23230:5141C:6884DAE9
content-encoding: gzip
accept-ranges: bytes
date: Sat, 26 Jul 2025 13:40:58 GMT
via: 1.1 varnish
x-served-by: cache-bom-vanm7210074-BOM
x-cache: MISS
x-cache-hits: 0
x-timer: S1753537258.025991,VS0,VE257
vary: Authorization,Accept-Encoding
access-control-allow-origin: *
cross-origin-resource-policy: cross-origin
x-fastly-request-id: 53295ccbc7ab95980eb50b0179a7c19580eed35a
expires: Sat, 26 Jul 2025 13:45:58 GMT
source-age: 0
content-length: 669
!function(){var module=angular.module("toggle-switch",["ng"]);module.provider("toggleSwitchConfig",[function(){this.onLabel="On",this.offLabel="Off",this.knobLabel=" ";var self=this;this.$get=function(){return{onLabel:self.onLabel,offLabel:self.offLabel,knobLabel:self.knobLabel}}}]),module.directive("toggleSwitch",["toggleSwitchConfig",function(toggleSwitchConfig){return{restrict:"EA",replace:!0,require:"ngModel",scope:{disabled:"@",onLabel:"@",offLabel:"@",knobLabel:"@"},template:'',compile:function(element,attrs){return attrs.onLabel||(attrs.onLabel=toggleSwitchConfig.onLabel),attrs.offLabel||(attrs.offLabel=toggleSwitchConfig.offLabel),attrs.knobLabel||(attrs.knobLabel=toggleSwitchConfig.knobLabel),this.link},link:function(scope,element,attrs,ngModelCtrl){var KEY_SPACE=32;element.on("click",function(){scope.$apply(scope.toggle)}),element.on("keydown",function(e){var key=e.which?e.which:e.keyCode;key===KEY_SPACE&&scope.$apply(scope.toggle)}),ngModelCtrl.$formatters.push(function(modelValue){return modelValue}),ngModelCtrl.$parsers.push(function(viewValue){return viewValue}),ngModelCtrl.$viewChangeListeners.push(function(){scope.$eval(attrs.ngChange)}),ngModelCtrl.$render=function(){scope.model=ngModelCtrl.$viewValue},scope.toggle=function(){scope.disabled||(scope.model=!scope.model,ngModelCtrl.$setViewValue(scope.model))}}}}])}();