-
Notifications
You must be signed in to change notification settings - Fork 65
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1227 +/- ##
======================================
Coverage 100% 100%
======================================
Files 355 355
Lines 6620 6620
Branches 853 853
======================================
Hits 6620 6620
Continue to review full report at Codecov.
|
@@ -100,6 +101,10 @@ export class SkyColorpickerInputDirective | |||
} | |||
|
|||
public ngOnInit() { | |||
if (this.initialColor === undefined) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like you're trying to prevent initialColor
from being undefined, but doing so here only prevents it before ngOnInit
and not during subsequent rounds of change detection. What I would suggest is using a property setter that checks for undefined and then sets the property to the default color in that case. Then it won't matter when it's set.
// Outside the class declaration
const DEFAULT_COLOR = '#FFFFFF';
@Input()
public set initialColor(value: string) {
this._initialColor = value || DEFAULT_COLOR;
}
public get initialColor(): string {
return this._initialColor;
}
private _initialColor = DEFAULT_COLOR;
Addresses:
#1128
#1178
#1175
#1173