Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Another Problem with require.js and ngtable #340

Closed
jwu009 opened this issue Jun 6, 2014 · 2 comments
Closed

Another Problem with require.js and ngtable #340

jwu009 opened this issue Jun 6, 2014 · 2 comments

Comments

@jwu009
Copy link

jwu009 commented Jun 6, 2014

I am using ngtable with requires.js and got the following error:
TypeError: angular is undefined in line 49, var app = angular.module('ngTable', []);

I have the requirejs configure like this:
require.config({
paths: {
'angular': "../Scripts/angular",
'angular-route': "../Scripts/angular-route",
'ng-table': "../Scripts/ng-table",
...
},
shim: {
'angular': ['jquery'],
'angular-route': ['angular'],
'ng-table': "../Scripts/ng-table",
...

The result htmp page head shows angular.js is before ngTable. Why 'angular' is undefined in ngtable.js?

Thanks,

jwu

@nbppp2
Copy link

nbppp2 commented Mar 13, 2015

I'm hoping you already figured this out. Just in case, the value of the property 'ng-table' in your shim object should be

['angular']

not

"../Scripts/ng-table"

Thus you end up with

require.config({

paths: {
'angular': "../Scripts/angular",
'angular-route': "../Scripts/angular-route",
'ng-table': "../Scripts/ng-table",
...
},
shim: {
'angular': ['jquery'],
'angular-route': ['angular'],
'ng-table': ['angular'],
...

Hope this helps.

@yehiaa
Copy link

yehiaa commented Jan 17, 2016

don't forget to export angular in shim otherwise u'll get angular' is undefined

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants