diff --git a/src/timepicker/test/timepicker.spec.js b/src/timepicker/test/timepicker.spec.js index 9d329ccf64..7958b2d463 100644 --- a/src/timepicker/test/timepicker.spec.js +++ b/src/timepicker/test/timepicker.spec.js @@ -601,6 +601,20 @@ describe('timepicker directive', function () { }); }); + describe('`readonly-input` attribute', function() { + beforeEach(inject(function() { + $rootScope.meridiansArray = ['am', 'pm']; + element = $compile('')($rootScope); + $rootScope.$digest(); + })); + + it('should make inputs readonly', function () { + var inputs = element.find('input'); + expect(inputs.eq(0).attr('readonly')).toBe('readonly'); + expect(inputs.eq(1).attr('readonly')).toBe('readonly'); + }); + }); + describe('setting timepickerConfig steps', function() { var originalConfig = {}; beforeEach(inject(function(_$compile_, _$rootScope_, timepickerConfig) { diff --git a/src/timepicker/timepicker.js b/src/timepicker/timepicker.js index 5cce447415..045e19b989 100644 --- a/src/timepicker/timepicker.js +++ b/src/timepicker/timepicker.js @@ -26,7 +26,7 @@ angular.module('ui.bootstrap.timepicker', []) this.setupMousewheelEvents( hoursInputEl, minutesInputEl ); } - $scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput; + $scope.readonlyInput = angular.isDefined($attrs.readonlyInput) ? $scope.$parent.$eval($attrs.readonlyInput) : timepickerConfig.readonlyInput; this.setupInputEvents( hoursInputEl, minutesInputEl ); }; @@ -243,7 +243,7 @@ angular.module('ui.bootstrap.timepicker', []) replace: true, scope: {}, templateUrl: 'template/timepicker/timepicker.html', - link: function(sscope, element, attrs, ctrls) { + link: function(scope, element, attrs, ctrls) { var timepickerCtrl = ctrls[0], ngModelCtrl = ctrls[1]; if ( ngModelCtrl ) {