Last active
March 3, 2016 11:17
-
-
Save zachlysobey/f55aa14daca3f3eda6fa to your computer and use it in GitHub Desktop.
Angular 1 Directive with ES6 Multi-line string template inline.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function() { | |
'use strict'; | |
angular | |
.module('myModule') | |
.directive('myDirective', myDirective); | |
const template = ` | |
<div class="my-directive-template"> | |
<h1>Using multi-line Strings for templates</h1> | |
<p> | |
Of course, this will currently only work | |
when transpiling the ES6 code to ES5 with | |
something like Babel | |
</p> | |
</div> | |
`; | |
function myDirective() { | |
return { | |
template: template, | |
restrict: 'E' | |
}; | |
} | |
}()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thats a neat spin on this idea!

I think you're missing a
controller:
key there though: