rangy icon indicating copy to clipboard operation
rangy copied to clipboard

Rangy with RequireJs and AngularJs

Open lakadepr opened this issue 9 years ago • 1 comments

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 ?

lakadepr avatar Apr 13 '16 07:04 lakadepr

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;
    };
});

michaelwoods avatar May 04 '16 20:05 michaelwoods