Angular + Requirejs - Loading in the wrong order

前端 未结 3 1943
旧时难觅i
旧时难觅i 2021-01-15 00:51

I\'m trying to have angular and jquery loaded with requirejs. The best I can do is that 50% of the time everything loads correctly, the other half I get the error No

3条回答
  •  情书的邮戳
    2021-01-15 01:33

    Add Jquery as a dependency for Angular in the shim.

    require.config({
          paths: {
            'jQuery': '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min',
            'angular': '//ajax.googleapis.com/ajax/libs/angularjs/1.0.7/angular',
          },
          shim: {
            'angular' : {'exports' : 'angular', deps: ['jQuery']},
            'jQuery': {'exports' : 'jQuery'}
          }
    });
    

提交回复
热议问题