fix(index): display code example corretly

This commit fixes the displaying of the „name“ template variable (see
screenshot below) in the code example on the front page.

https://goo.gl/qcLf5X
This commit is contained in:
Jacob Müller 2015-06-03 12:24:26 +02:00 committed by Alex Eagle
parent 67851e3513
commit 45d136e327
2 changed files with 12 additions and 11 deletions

View File

@ -11,8 +11,7 @@
h3.text-headline Start Quick, Build Fast
p.text-body Express your ideas with clean, understandable code. Angular is simple to build on, easy to change, and friendly to the way UX designers work. Create a UI that is beautiful by default, with material design and support for web components. Angular takes <a href="/docs/js/latest/quickstart.html">just minutes to learn</a>.
.c6
pre.prettyprint.linenums.is-showcase
code.
code-example(language="javascript" format="linenums" showcase="true").
@Component({selector: 'my-app'})
@View({template: '&lt;h1&gt;Hi {{ name }}&lt;/h1&gt;'})

View File

@ -11,7 +11,9 @@ angularIO.directive('codeExample', function() {
compile: function(tElement, attrs) {
var html = (attrs.escape === "html") ? _.escape(tElement.html()) : tElement.html();
var template = '<pre class="prettyprint ' + attrs.format + ' lang-' + attrs.language + '">' +
var classes = 'prettyprint ' + attrs.format + ' lang-' + attrs.language +
(attrs.showcase === 'true' ? ' is-showcase' : '');
var template = '<pre class="' + classes + '">' +
'<code ng-non-bindable>' + html + '</code>' +
'</pre>';