Last active
August 29, 2015 14:03
-
-
Save VanDalkvist/05caa9d93bd775c51d13 to your computer and use it in GitHub Desktop.
Директива для подсветки кода (source - http://habrahabr.ru/post/164493/)
This file contains 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
.directive('uiSource', function () { | |
return { | |
restrict: 'EA', | |
compile: function (elem) { | |
var escape = function(content) { | |
return content | |
.replace(/\&/g, '&') | |
.replace(/\</g, '<') | |
.replace(/\>/g, '>') | |
.replace(/"/g, '"'); | |
}; | |
var pre = angular.element('<pre class="prettyprint linenums"></pre>'); | |
pre.append(prettyPrintOne(escape(elem.html().slice(1)), undefined, true)); | |
elem.replaceWith(pre); | |
} | |
}; | |
}); |
This file contains 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
<ui-source> | |
<ui-source> | |
<div> | |
<label>Name:</label> | |
<input type="text" ng-model="yourName" placeholder="Enter a name here"> | |
<hr> | |
<h1>Hello {{yourName}}!</h1> | |
</div> | |
</ui-source> | |
</ui-source> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment