Skip to content
This repository has been archived by the owner on Jun 25, 2022. It is now read-only.

Commit

Permalink
Check if label exist before add spaces
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentM committed Oct 11, 2015
1 parent 281ac9f commit ae12178
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions src/coffee/toggle_switch.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -131,25 +131,31 @@ angular.module('sc-toggle-switch', ['stcs-templates'])
$scope.knobLabelStr = angular.copy($scope.knobLabel)

if ($scope.leftLabel.length == max)
while ($scope.rightLabelStr.length < max)
$scope.rightLabelStr = '\u00a0' + $scope.rightLabelStr + '\u00a0'
if $scope.rightLabelStr
while ($scope.rightLabelStr.length < max)
$scope.rightLabelStr = '\u00a0' + $scope.rightLabelStr + '\u00a0'

while ($scope.knobLabelStr.length < max)
$scope.knobLabelStr = '\u00a0' + $scope.knobLabelStr + '\u00a0'
if $scope.knobLabelStr
while ($scope.knobLabelStr.length < max)
$scope.knobLabelStr = '\u00a0' + $scope.knobLabelStr + '\u00a0'

else if ($scope.rightLabel.length == max)
while ($scope.leftLabelStr.length < max)
$scope.leftLabelStr = '\u00a0' + $scope.leftLabelStr + '\u00a0'
if $scope.leftLabelStr
while ($scope.leftLabelStr.length < max)
$scope.leftLabelStr = '\u00a0' + $scope.leftLabelStr + '\u00a0'

while ($scope.knobLabelStr.length < max)
$scope.knobLabelStr = '\u00a0' + $scope.knobLabelStr + '\u00a0'
if $scope.knobLabelStr
while ($scope.knobLabelStr.length < max)
$scope.knobLabelStr = '\u00a0' + $scope.knobLabelStr + '\u00a0'

else
while ($scope.leftLabelStr.length < max)
$scope.leftLabelStr = '\u00a0' + $scope.leftLabelStr + '\u00a0'
if $scope.leftLabelStr
while ($scope.leftLabelStr.length < max)
$scope.leftLabelStr = '\u00a0' + $scope.leftLabelStr + '\u00a0'

while ($scope.rightLabelStr.length < max)
$scope.rightLabelStr = '\u00a0' + $scope.rightLabelStr + '\u00a0'
if $scope.rightLabelStr
while ($scope.rightLabelStr.length < max)
$scope.rightLabelStr = '\u00a0' + $scope.rightLabelStr + '\u00a0'


$scope.$watch 'leftLabel', ->
Expand Down

0 comments on commit ae12178

Please sign in to comment.