Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit d0deb37

Browse files
devversionThomasBurleson
authored andcommitted
fix(demo): observe interpolated docs-demo attributes + fix layout alignment interactive demo
Fixes #6564 Fixes #6361 Fixes #6319 Closes #6567
1 parent 4ef9674 commit d0deb37

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

docs/app/js/demo.js

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ DocsApp
33
.directive('layout', function() { return angular.noop; })
44
.directive('docsDemo', [
55
'$mdUtil',
6-
function($mdUtil) {
6+
function() {
77
return {
88
restrict: 'E',
99
scope: true,
@@ -14,13 +14,23 @@ function($mdUtil) {
1414
bindToController: true
1515
};
1616

17-
function DocsDemoCtrl($scope, $element, $attrs, $interpolate, codepen) {
17+
function DocsDemoCtrl($scope, $element, $attrs, codepen) {
1818
var self = this;
1919

2020
self.interpolateCode = angular.isDefined($attrs.interpolateCode);
21-
self.demoId = $interpolate($attrs.demoId || '')($scope.$parent);
22-
self.demoTitle = $interpolate($attrs.demoTitle || '')($scope.$parent);
23-
self.demoModule = $interpolate($attrs.demoModule || '')($scope.$parent);
21+
22+
$attrs.$observe('demoTitle', function(value) {
23+
self.demoTitle = value;
24+
});
25+
26+
$attrs.$observe('demoId', function(value) {
27+
self.demoId = value;
28+
});
29+
30+
$attrs.$observe('demoModule', function(value) {
31+
self.demoModule = value;
32+
});
33+
2434
self.files = {
2535
css: [], js: [], html: []
2636
};

docs/app/partials/layout-alignment.tmpl.html

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
<td>layout-align</td>
2424
<td>Sets default alignment unless overridden by another breakpoint.</td>
2525
</tr>
26-
<tr>
26+
<tr>
2727
<td>layout-align-xs</td>
2828
<td>width &lt; <b>600</b>px</td>
2929
</tr>
@@ -67,20 +67,18 @@
6767
Below is an interactive demo that lets you explore the visual results of the different settings:
6868
</p>
6969

70-
<section class="layout-panel-parent">
71-
<div >
72-
<docs-demo demo-title='layout="{{layoutDemo.direction}}" &nbsp; &nbsp; &nbsp; layout-align="{{layoutAlign()}}"'
73-
class="small-demo colorNested" interpolate-code="true">
74-
<demo-file name="index.html">
75-
<div layout="{{layoutDemo.direction}}" layout-align="{{layoutAlign()}}">
76-
<div>one</div>
77-
<div>two</div>
78-
<div>three</div>
79-
</div>
80-
</demo-file>
81-
</docs-demo>
82-
</div>
83-
</section>
70+
<div>
71+
<docs-demo demo-title='layout="{{layoutDemo.direction}}" &nbsp; &nbsp; &nbsp; layout-align="{{layoutAlign()}}"'
72+
class="small-demo colorNested" interpolate-code="true">
73+
<demo-file name="index.html">
74+
<div layout="{{layoutDemo.direction}}" layout-align="{{layoutAlign()}}">
75+
<div>one</div>
76+
<div>two</div>
77+
<div>three</div>
78+
</div>
79+
</demo-file>
80+
</docs-demo>
81+
</div>
8482

8583
<div layout="column" layout-gt-sm="row" layout-align="space-around">
8684

0 commit comments

Comments
 (0)