I recently started working with AngularJS and I have an App where I am using the Sir Trevor content editor. I want to add some custom blocks to the editor by extending it, but I am having trouble accessing angular services within my extension code. The extension code is currently inside a Self-Executing Anonymous Function in a separate file.
(function() {
// check SirTrevor exists...
if(SirTrevor){
SirTrevor.Blocks.NewBlock = SirTrevor.Block.extend({
// adding custom functionality
})
SirTrevor.Blocks.AnotherNewBlock = SirTrevor.Block.extend({
// more custom functionality
})
}
})()
I need to be able to use angular services within this code, but simply passing them as arguments to the function does not work. I am looking for a way to execute this code so I can access and inject angular services. I have ruled out using a directive, factory, or service for various reasons. Any suggestions on how to achieve this?
Any ideas on how I can access angular services in this context without modifying the SirTrevor.js file, as it might get overwritten during updates or installations?