FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
angular-toggle-switch/angular-toggle-switch.min.js at master · mmaestri/angular-toggle-switch · GitHub
mmaestri
/
angular-toggle-switch
Public
forked from
cgarvis/angular-toggle-switch
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
angular-toggle-switch
/
angular-toggle-switch.min.js
Copy path
More file actions
More file actions
Latest commit
History
History
History
1 lines (1 loc) · 862 Bytes
Breadcrumbs
angular-toggle-switch
/
angular-toggle-switch.min.js
Copy path
File metadata and controls
1 lines (1 loc) · 862 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
angular
.
module
(
"toggle-switch"
,
[
"ng"
]
)
.
directive
(
"toggleSwitch"
,
function
(
)
{
return
{
restrict
:
"EA"
,
replace
:
!
0
,
scope
:
{
model
:
"="
,
onLabel
:
"@"
,
offLabel
:
"@"
,
knobLabel
:
"@"
}
,
template
:
'<div class="switch" ng-click="toggle()"><div ng-class="{\'switch-off\': !model, \'switch-on\': model}"><span class="switch-left" ng-bind="onLabel">On</span><span class="knob" ng-bind="knobLabel"> </span><span class="switch-right" ng-bind="offLabel">Off</span></div></div>'
,
link
:
function
(
$scope
,
element
,
attrs
)
{
attrs
.
$observe
(
"onLabel"
,
function
(
val
)
{
$scope
.
onLabel
=
angular
.
isDefined
(
val
)
?
val
:
"On"
}
)
,
attrs
.
$observe
(
"offLabel"
,
function
(
val
)
{
$scope
.
offLabel
=
angular
.
isDefined
(
val
)
?
val
:
"Off"
}
)
,
attrs
.
$observe
(
"knobLabel"
,
function
(
val
)
{
$scope
.
knobLabel
=
angular
.
isDefined
(
val
)
?
val
:
" "
}
)
,
$scope
.
toggle
=
function
(
)
{
element
.
children
(
)
.
addClass
(
"switch-animate"
)
,
$scope
.
model
=
!
$scope
.
model
}
}
}
}
)
;
Back
|
FazBrowse Home
|
New Git URL