Harrison Tran Harrison Tran - 6 months ago 9
AngularJS Question

AngularJS 1 include preformated html code from templates

I'm writing a tutorial website for angularjs using angularjs and I have a lot sections of sample code.
So I have a bunch of

<pre>&lt;html ng-app&gt;&lt;/html&gt;</pre>
tags.

I want to put the code samples in a separate files but
ng-include
doesn't work on
<pre></pre>
tags. How would I put html code samples in separate files?

Small side question: what would you name the folder of those files?

I've tried this solution:
http://stackoverflow.com/a/34164921/859082

But it doesn't seem to work because the sample doesn't stay preformatted for newlines and tabs and I don't know why it doesn't work. Here's my attempt using the previous solution:
http://plnkr.co/edit/0nP76Im6XWWCleShsxAR?p=preview

Answer

Set CSS white-space: pre-wrap; for your myPre directive.

Comments