Skip to content

How can I use it for RequireJS #62

@rushijoshi

Description

@rushijoshi

Hi Matt,

I have used your library in AngularJS with little of modification mainly for ThridParty controls it is working absolutely fine.

Now we have requirements to implement with RequireJS with AngularAMD and we are loading Angular from AMD modules, now how we can implement UnsavedChanges library there.

When I am loading it from path/shim in main.JS with Angular as dependency, your library is not getting load.

Below is code I have in my Main.JS, and just to keep strait, I kept unsavedChanges.js file in same location where Main.JS file is.

require.config({

    baseUrl: "js/",

    // alias libraries paths
    paths: {
        'jquery': '../bower_components/jquery/jquery.min',
        'angular': '../bower_components/angular/angular',
        'angularAMD': '../bower_components/angularAMD/angularAMD',
        'bootstrap': '../bower_components/bootstrapjs/js/bootstrap.min',
        'unsavedChanges': 'unsavedChanges',
    },

    // Add angular modules that does not support AMD out of the box, put it in a shim
    shim: {
        'angular': ['jquery'],
        'angularAMD': ['angular'],
        'angular-ui-router': ['angular'],
        'bootstrap':
        {
            deps: ['jquery']
        },
        'unsavedChanges': {
            deps: ['angular'],
            exports: 'unsavedChanges'

        }
    },

    // kick start application
    deps: ['app']
});

Please let me know what I missing, resolving this your library may help lot more people who are implementing AMD and who knows may be for TypeScript :)

Thanks
Rushi

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions