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

Commit

Permalink
fix(demo): observe interpolated docs-demo attributes + fix layout ali…
Browse files Browse the repository at this point in the history
…gnment interactive demo

Fixes #6564 Fixes #6361 Fixes #6319

  Closes #6567
  • Loading branch information
devversion authored and ThomasBurleson committed Feb 1, 2016
1 parent 4ef9674 commit d0deb37
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 20 deletions.
20 changes: 15 additions & 5 deletions docs/app/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DocsApp
.directive('layout', function() { return angular.noop; })
.directive('docsDemo', [
'$mdUtil',
function($mdUtil) {
function() {
return {
restrict: 'E',
scope: true,
Expand All @@ -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: []
};
Expand Down
28 changes: 13 additions & 15 deletions docs/app/partials/layout-alignment.tmpl.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<td>layout-align</td>
<td>Sets default alignment unless overridden by another breakpoint.</td>
</tr>
<tr>
<tr>
<td>layout-align-xs</td>
<td>width &lt; <b>600</b>px</td>
</tr>
Expand Down Expand Up @@ -67,20 +67,18 @@
Below is an interactive demo that lets you explore the visual results of the different settings:
</p>

<section class="layout-panel-parent">
<div >
<docs-demo demo-title='layout="{{layoutDemo.direction}}" &nbsp; &nbsp; &nbsp; layout-align="{{layoutAlign()}}"'
class="small-demo colorNested" interpolate-code="true">
<demo-file name="index.html">
<div layout="{{layoutDemo.direction}}" layout-align="{{layoutAlign()}}">
<div>one</div>
<div>two</div>
<div>three</div>
</div>
</demo-file>
</docs-demo>
</div>
</section>
<div>
<docs-demo demo-title='layout="{{layoutDemo.direction}}" &nbsp; &nbsp; &nbsp; layout-align="{{layoutAlign()}}"'
class="small-demo colorNested" interpolate-code="true">
<demo-file name="index.html">
<div layout="{{layoutDemo.direction}}" layout-align="{{layoutAlign()}}">
<div>one</div>
<div>two</div>
<div>three</div>
</div>
</demo-file>
</docs-demo>
</div>

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

Expand Down

0 comments on commit d0deb37

Please sign in to comment.