Skip to content

Monthly Archives: June 2017

AngularJS ng-repeat limitTo with Objects


<div ng-repeat="(key, value) in object | limitTo: 2"> will not work, as ngRepeat needs a string or an array to work with. A workaround is to use ng-if="$index < 2". <div ng-repeat="(key, value) in object" ng-if="$index < 2"> Do note that the order of keys for any given object may vary.

CSS: Last of specific class, not child of parent


As per discussion in Stackoverflow, at the moment CSS's last-of-type selector is the best way to access last element, but apparently that does not apply to class, but the element. And even so, when trying to create A | B | C NOT, this does not work. <div> <span class="separated">A</span> <span class="separated">B</span> <span class="separated">C</span> <span class="not">NOT</span> […]