From b26a7fa93a60ee9632bf0815ecb14a872be0d3cb Mon Sep 17 00:00:00 2001 From: Troy Gilbert Date: Fri, 22 May 2015 16:40:09 -0500 Subject: [PATCH] Add nesting depth to scope Adds a simple $depth value to the $scope so that templates can use it for styling, etc. --- app/js/directives.js | 1 + 1 file changed, 1 insertion(+) diff --git a/app/js/directives.js b/app/js/directives.js index 54db449..6f3f6f5 100644 --- a/app/js/directives.js +++ b/app/js/directives.js @@ -281,6 +281,7 @@ angular.module('app.directives', []) childScope.$last = (index === (arrayLength - 1)); childScope.$middle = !(childScope.$first || childScope.$last); childScope.$odd = !(childScope.$even = index%2==0); + childScope.$depth = $scope.$depth != undefined ? $scope.$depth + 1 : 0; if (!block.startNode) { linker(childScope, function(clone) {