Angularjs + Requirejs + Ngnestable

Asked

Viewed 23 times

0

Talk guys, all right? So I’m working with Requirejs along with Angularjs, today I needed to work with an Ngnestable lib

kamilkp/ng-nestable

But when I try to load the directive into my app as follows:

define(['angularamd', 'angular-uirouter', 'angular-nestable'], function (angularAMD) {

    var app = angular.module('appFerramentaria', [
        'ui.router',
        'ng-nestable'
    ]);

    {...}
});

The following error is returned: inserir a descrição da imagem aqui inserir a descrição da imagem aqui This is my Requirejs configuration file (main.js), I believe the error may be in the order in which I am calling the files

require.config({
    baseUrl: '/portais/colaborador_novo/assets_novo/js',
    urlArgs: "v=" +  (new Date()).getTime(),// desenv
    paths: {
        'jquery': 'jquery.min',
        'bootstrap': 'bootstrap-rjs.min',
        'angular': 'angular1-7.min',
        'angular-uirouter': 'angular-ui-router.min',
        'angularamd': 'angularAMD.min',
        'jquery.nestable': 'jquery.nestable',
        'angular-nestable': 'angular-nestable',
        'app': '../../app/views/ferramentaria/app',
    },
    shim: {
        'angular': ['jquery', 'bootstrap'],
        'angularamd': ['angular'],
        'angular-uirouter': ['angular', 'angularamd'],
        'jquery.nestable': ['jquery'],
        'angular-nestable': ['jquery.nestable', 'angular']
    },
    deps: [
        'app'
    ]
});

Thanks in advance, thanks :)

1 answer

0


Hello after much turning around I found a solution:

shim: {
    'angular': {
        deps: ['jquery', 'bootstrap'],
        exports: 'angular'
    },
{...}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.