Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save leomrocha/2abe02c8f20edc686dcc to your computer and use it in GitHub Desktop.
Save leomrocha/2abe02c8f20edc686dcc to your computer and use it in GitHub Desktop.
mainApp.directive('vextab', function($compile){
//console.log("rendering vextab");
var canvas = document.createElement('canvas');
renderer = new Vex.Flow.Renderer( canvas,
//Vex.Flow.Renderer.Backends.SVG);
Vex.Flow.Renderer.Backends.CANVAS);
artist = new Vex.Flow.Artist(10, 10, 800, {scale: 0.8});
vextab = new Vex.Flow.VexTab(artist);
return{
restrict: 'E',
link: function(scope, element, attrs){
try {
vextab.reset();
artist.reset();
vextab.parse(element.text());
artist.render(renderer);
}
catch (e) {
console.log("Error");
console.log(e);
}
//element.appendChild(canvas);
$compile(canvas)(scope);
//element.append(canvas);
element.replaceWith(canvas);
//console.log("vextab processing");
}
}
});
@felipediasssss
Copy link

Hi, i'm trying to use this directive in angularjs, but i'm getting the error:

Error: Vex.Flow.Artist is not a constructor

Do you know why ?

@paul-fedotov
Copy link

Hello, felipediasssss. Did you fix that bug?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment