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

Commit 1f27501

Browse files
petebacondarwinvojtajina
authored andcommitted
docs(runnableExamples): add "edit in Plunker" button
The "runnableExample.template.html" template overrides the one in the dgeni-packages "examples" package with a similar template that also has a link to a special Plunker URL that can pull in the example from our code.angularjs.org website.
1 parent 5b93e5f commit 1f27501

File tree

2 files changed

+29
-0
lines changed

2 files changed

+29
-0
lines changed

docs/app/src/docs.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ angular.module('DocsController', [])
22

33
.controller('DocsController', function($scope, $rootScope, $location, $window, $cookies, NG_PAGES, NG_NAVIGATION, NG_VERSION) {
44

5+
$scope.docsVersion = NG_VERSION.isSnapshot ? 'snapshot' : NG_VERSION.version;
6+
57
$scope.fold = function(url) {
68
if(url) {
79
$scope.docs_fold = '/notes/' + url;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{# Be aware that we need these extra new lines here or marked will not realise that the <div>
2+
is HTML and wrap each line in a <p> - thus breaking the HTML #}
3+
4+
<div>
5+
<a ng-href="http://plnkr.co/edit/ngdoc:{$ doc.example.id $}@{{docsVersion}}?p=preview" class="btn pull-right" target="_blank">
6+
<i class="glyphicon glyphicon-edit">&nbsp;</i>
7+
Edit in Plunker</a>
8+
<div class="runnable-example"
9+
path="{$ doc.example.outputFolder $}"
10+
{%- for attrName, attrValue in doc.example.attributes %}
11+
{$ attrName $}="{$ attrValue $}"{% endfor %}>
12+
13+
{% for fileName, file in doc.example.files %}
14+
<div class="runnable-example-file" {% for attrName, attrValue in file.attributes %}
15+
{$ attrName $}="{$ attrValue $}"{% endfor %}>
16+
{% code -%}
17+
{$ file.fileContents $}
18+
{%- endcode %}
19+
</div>
20+
{% endfor %}
21+
22+
<iframe class="runnable-example-frame" src="{$ doc.example.outputFolder $}/index.html" name="{$ doc.example.id $}"></iframe>
23+
</div>
24+
</div>
25+
26+
{# Be aware that we need these extra new lines here or marked will not realise that the <div>
27+
above is HTML and wrap each line in a <p> - thus breaking the HTML #}

0 commit comments

Comments
 (0)