rangy
rangy copied to clipboard
Rangy with RequireJs and AngularJs
Hi,
I am trying to use Rangy with Requirejs. I have added rangy-core in require config Path and shim section as below require.config({ paths: { 'rangy': '../../Scripts/rangy-core', }, shim: { 'rangy': { exports: 'rangy', init: function () { return this.rangy; }, }, } })
In require section I have added 'rangy' but still I am getting error as rangy is undefined. so can anybody help me to resolve this issue ?
I had a similar issue as you and my config was similar (no init), however I needed this definition for another lib that was looking for it on the global scope:
define(['rangy-core'], function (rangy) {
'use strict';
if (!rangy.initialized) {
rangy.init();
}
window.rangy = window.rangy || rangy;
return function () {
return window.rangy;
};
});