These are chat archives for angular/material

16th
Sep 2015
jesse snyder
@steezeburger
Sep 16 2015 14:50
so i recreated most of the functionality from angular material's own website menu, but am not sure how they show the current menu item as active after a refresh
im sure they check state and then set it that way, but im having trouble imagining when to calculate that
anyone have any ideas? or can point me to their code? currently looking at obfuscated js on their site
i think i actually found the non obfuscated code on github
Dave Ackerman
@dmackerman
Sep 16 2015 15:38
@steezeburger: they probably just apply a “active” class based on the URL
<a class="md-button md-default-theme" ng-transclude="" ng-class="{'active' : isSelected()}" ng-href="#/demo/material.components.button" ng-click="focusSection()" tabindex="0" href="#/demo/material.components.button"><span class="ng-binding ng-scope">
  Button
  </span><!-- ngIf: isSelected() -->
<div class="md-ripple-container"></div></a>
jesse snyder
@steezeburger
Sep 16 2015 16:19
i must be doing something slightly different as it doesnt work after refresh
jesse snyder
@steezeburger
Sep 16 2015 16:31
it seems that the active is just for styling
ive got bigger fish to fry atm. ill come back to this later and spend time really digging into their menu
jesse snyder
@steezeburger
Sep 16 2015 16:43
it looks like the $watch on $onLocationChangeSuccess calls onLocationChange which checks $location.path() against the pages and selets the section and page in the menu service
This message was deleted
    var matchPage = function(section, page) {
      if (path === page.url) {
        self.selectSection(section);
        self.selectPage(section, page);
      }
    };
im not sure where the $onLocationChangeSuccess is though
(im also using ui-router, so states instead of urls) where is a good place check for current state after a page refresh, then i can set the current section there
jesse snyder
@steezeburger
Sep 16 2015 17:23
ah $onLocationChangeSuccess is something on the rootscope provided by $location? i guess i can use $stateChangeSuccess
jesse snyder
@steezeburger
Sep 16 2015 20:29
anyone have problems with adding lots of content inside md-content? it crashes ie if enough elements are added. maybe something with calculating scroll height? it does a lot of buggy resizing as well
http://codepen.io/anon/pen/ojxjBd you can test by going here in ie10 and adding quite a few recipients
jesse snyder
@steezeburger
Sep 16 2015 21:07
looks like its something to do with flex constantly calculating height for scrollable content in ie?