A working example of how to integrate the graph layout tool mermaid with Angular.js. The important areas to consider are
- Usage of sanitize on the mermaid object before rendering it on the page
var gs = "graph TD; " + $scope.graphScript
return $sce.trustAsHtml(gs);
- Reinitializing the mermaid engine after updating the graph
setTimeout(function(){mermaid.init();},1000)
The index.html is the code for the live demo which can be seen here: http://kmader.github.io/angular-mermaid-js/