Angular Showdown directive compile
HTML
<script src="https://raw.github.com/coreyti/showdown/master/src/showdown.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
Data : {{data}}
<myhtml></myhtml>
JavaScript
angular.module('myApp', []).directive('myhtml', function($http) {
var data = $.param({
json: JSON.stringify({
html: '<html><body> Hello <div> from server</div> </body> </html>'
}),
delay: 1
});
return {
restrict: 'E',
scope: {},
template: '',
link: function(scope, element, attrs) {
$http.post('/echo/json/', data).success(function(re) {
element.html(re.html);
console.log("Testing : " + re.html);
});
}
}
});