From 4f54eabc592878e5025dadc52d8be69b0804b6de Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Mon, 22 May 2017 23:31:32 +0200 Subject: [PATCH 1/2] fix(checkbox): margin for empty checkboxes incorrectly added With #2121 the margin will be removed for checkboxes that don't have any label set. A problem is that the Checkbox uses the OnPush change detection strategy and therefore the checkbox is not able to detect any delayed / async label change. This means that checkboxes that set their label from an async binding will not have any margin until the users clicks on the checkbox. Using the `cdkObserveContent` seems to be an elegant approach when using the OnPush strategy. The `:empty` CSS selector would be more elegant but it's very sensitive about whitespaces and therefore it doesn't work properly. Fixes #4720 --- src/lib/checkbox/checkbox.html | 5 +++-- src/lib/checkbox/checkbox.ts | 11 +++-------- src/lib/checkbox/index.ts | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/lib/checkbox/checkbox.html b/src/lib/checkbox/checkbox.html index e07b211a679a..4a96aa9613f2 100644 --- a/src/lib/checkbox/checkbox.html +++ b/src/lib/checkbox/checkbox.html @@ -1,6 +1,6 @@