Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

Commit

Permalink
fix(ripple): fixes js error on button click for date picker
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert Messerle committed Aug 18, 2015
1 parent dbca2a4 commit be4311a
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/core/services/ripple/ripple.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,29 @@ function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdU
this.options = rippleOptions;
this.mousedown = false;
this.ripples = [];
this.container = null;
this.color = null;
this.background = null;
this.timeout = null; // Stores a reference to the most-recent ripple timeout
this.lastRipple = null;

this.valueOnUse('container', angular.bind(this, this.createContainer));
this.valueOnUse('color', angular.bind(this, this.getColor, 1));
this.valueOnUse('background', angular.bind(this, this.getColor, 0.5));

// attach method for unit tests
($element.controller('mdInkRipple') || {}).createRipple = angular.bind(this, this.createRipple);

this.bindEvents();
}

InkRippleCtrl.prototype.valueOnUse = function (key, getter) {
var value = null;
Object.defineProperty(this, key, {
get: function () {
if (value === null) value = getter();
return value;
}
});
};

/**
* Returns the color that the ripple should be (either based on CSS or hard-coded)
* @returns {string}
Expand Down Expand Up @@ -189,10 +200,6 @@ InkRippleCtrl.prototype.clearTimeout = function () {
* @param top
*/
InkRippleCtrl.prototype.createRipple = function (left, top) {
if (!this.container) this.container = this.createContainer();
if (!this.color) this.color = this.getColor();
if (!this.background) this.background = this.getColor(0.5);

var ctrl = this;
var ripple = angular.element('<div class="md-ripple"></div>');
var width = this.$element.prop('clientWidth');
Expand Down

0 comments on commit be4311a

Please sign in to comment.