You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I use Redactor callbacks while also having access to the current scope?
For example, if I want to change something on Keydown I should supply a keydownCallback as an option like in the provided example:
redactorOptions.keydownCallback = function triggerKeydown(e){
console.log("key down!");
}
But if I want to update something related to the current scope how can I go about that whilst still using the redactorOptions method for supplying callbacks.
E.g. how would I do this?
redactorOptions.keydownCallback = function triggerKeydown(e){
scope.doSomething(e); // throws an error because scope is not available
}
Thoughts?
The text was updated successfully, but these errors were encountered:
@sebastiansibelle What i did to fix that was to have an external function calling the scope inside of it:
.config(function(redactorOptions) {
redactorOptions.changeCallback = function (){
externalMethod();
};
});
And them in the plain javascript function this:
function externalMethod()
{
var scope = angular.element(_JQUERY_("#elementWithController")).scope();
scope.internalAngularMethod();
}
The "internalAngularMethod()" refers to any function o variable in the angular scope.
Notes that i have a no conflict version of JQuery ("JQUERY " = "$") at the top of the document, because the JQuery dolar sign gets in conflict with the dolar sign of angular. You may have a different (better) approach of this in your project.
How can I use Redactor callbacks while also having access to the current scope?
For example, if I want to change something on Keydown I should supply a keydownCallback as an option like in the provided example:
But if I want to update something related to the current scope how can I go about that whilst still using the redactorOptions method for supplying callbacks.
E.g. how would I do this?
Thoughts?
The text was updated successfully, but these errors were encountered: