So I'm trying to make a simple little pastebin, this is mostly a tech learning exercise for me. I've got everything working on the frontend except highlight.js (library chosen arbitrarily)
Here's my controller
define([
'highlight',
'angular',
], function( hl ) {
'use strict';
return [ '$scope', '$location', '$routeParams', 'pastes',
function ( $scope, $location, $routeParams, pastes ) {
console.log( pastes );
var digest = $routeParams.digest;
if ( pastes[digest] ) {
$scope.code = hl.highlightAuto( pastes[digest] ).value;
console.log( $scope.code );
}
$scope.view = function( view ) {
$location.path( view );
}
$scope.$apply();
}];
});
and my view
<pre ng-controller="Render"><code class="pre-scrollable">
{{code}}
</code></pre>
<button
type="button"
class="btn btn-primary pull-right"
ng-click="view('/')"
>New Paste</button>
to be fair this code works, the problem is that {{code}} seems to be sanitizing the html that is being spit out, so I need to find another way to do this. Tried a few other incantations of the library but no progress.