-
Notifications
You must be signed in to change notification settings - Fork 3.4k
fix(mdToolbar): Allow md-scroll-shrink usage with ng-if. #4394
Conversation
@ThomasBurleson When you review this PR, could you please check to ensure this doesn't constitute a breaking change? Particularly, I've added an isolate scope, but it should be okay since I added the transclusion. I just wanted a second pair of eyes. |
@@ -113,7 +157,7 @@ function mdToolbarDirective($$rAF, $mdConstant, $mdUtil, $mdTheming, $animate ) | |||
// | |||
// As the user scrolls down, the content will be transformed up slowly | |||
// to put the content underneath where the toolbar was. | |||
var margin = (-toolbarHeight * shrinkSpeedFactor) + 'px'; | |||
var margin = (-toolbarHeight * shrinkSpeedFactor) + 'px'; | |||
contentElement.css('margin-top', margin); | |||
contentElement.css('margin-bottom', margin); |
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.
I think this is better:
contentElement.css({
'margin-top' : margin,
'margin-bottom' : margin
});
|
||
$$rAF(updateToolbarHeight); | ||
} | ||
|
||
function onMdContentLoad($event, newContentEl) { | ||
// Toolbar and content must be siblings | ||
if (element.parent()[0] === newContentEl.parent()[0]) { |
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.
FYI - scope.$on(...)
will call onMdContentLoad( )
without the 2nd argument.
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.
In what case will it do so? All of my testing showed that it always passed the newContentEl
.
Previously, the toolbar would fail to enable scroll shrinking if the developer used an `ng-if` statement on the `md-toolbar`. This commit allows usage of `ng-if` as well as watching the `md-scroll-shrink` for changes so they can enable/disable scroll shrinking. Fixes #2751.
9e5432e
to
2ec70ea
Compare
Previously, the toolbar would fail to enable scroll shrinking if the developer used an `ng-if` statement on the `md-toolbar`. This commit allows usage of `ng-if` as well as watching the `md-scroll-shrink` for changes so they can enable/disable scroll shrinking. Fixes angular#2751. Closes angular#4394.
Previously, the toolbar would fail to enable scroll shrinking
if the developer used an
ng-if
statement on themd-toolbar
.This commit allows usage of
ng-if
as well as watching themd-scroll-shrink
for changes so they can enable/disablescroll shrinking.
Fixes #2751.