Just wondered if it's possible to listen for Firepad events in an Angularjs app?
I see the standard js code for detecting when Firepad is ready is:
firepad.on('ready', function() {
// Firepad is ready.
});
from http://www.firepad.io/docs/#api
but how can I detect this within a controller in Angular?
Do you already have code that initializes Firepad in your controller? I.e. something like
var firepad = Firepad.fromCodeMirror
. If so, you should be able to listen to the ready event on that the same as in plain JavaScript. If you don't have such code yet, you can find it in the Initializing Firepad section of firepad.io/docs/#api.To make it feel more integrated, you could probably wrap firepad in a directive quite easily. But "is there a library that does this?" is better suited for google than for StackOverflow.
That said, this library looks promising: https://github.com/davideast/FireDeck/blob/436fa59fb65a186beec857865c156ce2ada809e2/scripts/directives/firepad.js. It seems to introduce a
<fire-pad
element from what I can quickly gather in the demo site: http://fire-deck.firebaseapp.com.Note David's comment above too: