From 506bc5cafbdc0e106555afe5f3627a331c0ad407 Mon Sep 17 00:00:00 2001 From: Paul Gschwendtner Date: Wed, 6 Jan 2016 18:17:04 +0100 Subject: [PATCH] fix(demo): observe interpolated docs-demo attributes + fix layout alignment interactive demo Fixes #6564 Fixes #6361 Fixes #6319 --- docs/app/js/demo.js | 20 ++++++++++---- docs/app/partials/layout-alignment.tmpl.html | 28 +++++++++----------- 2 files changed, 28 insertions(+), 20 deletions(-) diff --git a/docs/app/js/demo.js b/docs/app/js/demo.js index d0e1a3a086b..a0592b2e1ac 100644 --- a/docs/app/js/demo.js +++ b/docs/app/js/demo.js @@ -3,7 +3,7 @@ DocsApp .directive('layout', function() { return angular.noop; }) .directive('docsDemo', [ '$mdUtil', -function($mdUtil) { +function() { return { restrict: 'E', scope: true, @@ -14,13 +14,23 @@ function($mdUtil) { bindToController: true }; - function DocsDemoCtrl($scope, $element, $attrs, $interpolate, codepen) { + function DocsDemoCtrl($scope, $element, $attrs, codepen) { var self = this; self.interpolateCode = angular.isDefined($attrs.interpolateCode); - self.demoId = $interpolate($attrs.demoId || '')($scope.$parent); - self.demoTitle = $interpolate($attrs.demoTitle || '')($scope.$parent); - self.demoModule = $interpolate($attrs.demoModule || '')($scope.$parent); + + $attrs.$observe('demoTitle', function(value) { + self.demoTitle = value; + }); + + $attrs.$observe('demoId', function(value) { + self.demoId = value; + }); + + $attrs.$observe('demoModule', function(value) { + self.demoModule = value; + }); + self.files = { css: [], js: [], html: [] }; diff --git a/docs/app/partials/layout-alignment.tmpl.html b/docs/app/partials/layout-alignment.tmpl.html index 5eaab284f20..eb969c00b92 100644 --- a/docs/app/partials/layout-alignment.tmpl.html +++ b/docs/app/partials/layout-alignment.tmpl.html @@ -23,7 +23,7 @@ layout-align Sets default alignment unless overridden by another breakpoint. - + layout-align-xs width < 600px @@ -67,20 +67,18 @@ Below is an interactive demo that lets you explore the visual results of the different settings:

-
-
- - -
-
one
-
two
-
three
-
-
-
-
-
+
+ + +
+
one
+
two
+
three
+
+
+
+