angular.js Uncaught Error: [ng:areq] Argument 'fn' is not a function, got Moment while working on...
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}
I've found this topic earlier es6 import moment.js in angular angular.js Error: [ng:areq] Argument 'fn' is not a function, got Moment, unfortunately, it wasn't solved.
So I decided to refresh this question and ask it again, this time by myself.
I'm importing moment.js from inside my app.js file, which is a source of my app's main module initialization:
...
import 'jquery/dist/jquery.js';
import moment from 'moment/moment.js';
import 'fullcalendar/dist/fullcalendar.min.js';
import 'fullcalendar/dist/gcal.min.js';
import 'angular-ui-calendar/src/calendar.js';
const app = angular
.module('app', [
uiRouter,
uiBootstrap,
'ui.bootstrap.datetimepicker',
uiMask,
cookies,
ngTranslate,
'ng-currency',
moment,
'ui.calendar',
sanitize,
uiSelect,
uiNotification,
'mm.acl',
Common.name,
Components.name
])
Above shown way of importing and dependency injection of moment.js lib, causes such error:
Uncaught Error: [ng:areq] Argument 'fn' is not a function, got Moment
http://errors.angularjs.org/1.5.8/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20Moment
Really don't know how to make it work.
Also, using webpack for app building process, but all new libraries and directives are imported into app's code directly, with ES6 import or require statements.
I'm not using webpack config for building and loading every single 3rd party module with webpack.
Don't have any clue how to import moment.js and make it work
javascript angularjs webpack angular-calendar
add a comment |
I've found this topic earlier es6 import moment.js in angular angular.js Error: [ng:areq] Argument 'fn' is not a function, got Moment, unfortunately, it wasn't solved.
So I decided to refresh this question and ask it again, this time by myself.
I'm importing moment.js from inside my app.js file, which is a source of my app's main module initialization:
...
import 'jquery/dist/jquery.js';
import moment from 'moment/moment.js';
import 'fullcalendar/dist/fullcalendar.min.js';
import 'fullcalendar/dist/gcal.min.js';
import 'angular-ui-calendar/src/calendar.js';
const app = angular
.module('app', [
uiRouter,
uiBootstrap,
'ui.bootstrap.datetimepicker',
uiMask,
cookies,
ngTranslate,
'ng-currency',
moment,
'ui.calendar',
sanitize,
uiSelect,
uiNotification,
'mm.acl',
Common.name,
Components.name
])
Above shown way of importing and dependency injection of moment.js lib, causes such error:
Uncaught Error: [ng:areq] Argument 'fn' is not a function, got Moment
http://errors.angularjs.org/1.5.8/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20Moment
Really don't know how to make it work.
Also, using webpack for app building process, but all new libraries and directives are imported into app's code directly, with ES6 import or require statements.
I'm not using webpack config for building and loading every single 3rd party module with webpack.
Don't have any clue how to import moment.js and make it work
javascript angularjs webpack angular-calendar
add a comment |
I've found this topic earlier es6 import moment.js in angular angular.js Error: [ng:areq] Argument 'fn' is not a function, got Moment, unfortunately, it wasn't solved.
So I decided to refresh this question and ask it again, this time by myself.
I'm importing moment.js from inside my app.js file, which is a source of my app's main module initialization:
...
import 'jquery/dist/jquery.js';
import moment from 'moment/moment.js';
import 'fullcalendar/dist/fullcalendar.min.js';
import 'fullcalendar/dist/gcal.min.js';
import 'angular-ui-calendar/src/calendar.js';
const app = angular
.module('app', [
uiRouter,
uiBootstrap,
'ui.bootstrap.datetimepicker',
uiMask,
cookies,
ngTranslate,
'ng-currency',
moment,
'ui.calendar',
sanitize,
uiSelect,
uiNotification,
'mm.acl',
Common.name,
Components.name
])
Above shown way of importing and dependency injection of moment.js lib, causes such error:
Uncaught Error: [ng:areq] Argument 'fn' is not a function, got Moment
http://errors.angularjs.org/1.5.8/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20Moment
Really don't know how to make it work.
Also, using webpack for app building process, but all new libraries and directives are imported into app's code directly, with ES6 import or require statements.
I'm not using webpack config for building and loading every single 3rd party module with webpack.
Don't have any clue how to import moment.js and make it work
javascript angularjs webpack angular-calendar
I've found this topic earlier es6 import moment.js in angular angular.js Error: [ng:areq] Argument 'fn' is not a function, got Moment, unfortunately, it wasn't solved.
So I decided to refresh this question and ask it again, this time by myself.
I'm importing moment.js from inside my app.js file, which is a source of my app's main module initialization:
...
import 'jquery/dist/jquery.js';
import moment from 'moment/moment.js';
import 'fullcalendar/dist/fullcalendar.min.js';
import 'fullcalendar/dist/gcal.min.js';
import 'angular-ui-calendar/src/calendar.js';
const app = angular
.module('app', [
uiRouter,
uiBootstrap,
'ui.bootstrap.datetimepicker',
uiMask,
cookies,
ngTranslate,
'ng-currency',
moment,
'ui.calendar',
sanitize,
uiSelect,
uiNotification,
'mm.acl',
Common.name,
Components.name
])
Above shown way of importing and dependency injection of moment.js lib, causes such error:
Uncaught Error: [ng:areq] Argument 'fn' is not a function, got Moment
http://errors.angularjs.org/1.5.8/ng/areq?p0=fn&p1=not%20a%20function%2C%20got%20Moment
Really don't know how to make it work.
Also, using webpack for app building process, but all new libraries and directives are imported into app's code directly, with ES6 import or require statements.
I'm not using webpack config for building and loading every single 3rd party module with webpack.
Don't have any clue how to import moment.js and make it work
javascript angularjs webpack angular-calendar
javascript angularjs webpack angular-calendar
asked Nov 22 '18 at 11:57
JohnDoenymJohnDoenym
243
243
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You should use angular-moment instead of the native momentjs package.
Added:import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ...but now theres another:ReferenceError: moment is not definedandTypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib
– JohnDoenym
Nov 22 '18 at 12:56
angular-momentassumes moment is global, but you are assigning momentjs to an own object namedmoment. Tryimport 'moment'instead.
– smonkey
Nov 22 '18 at 14:07
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
1
Also, angular-ui-calendar has some bug, which still causesReferenceError: moment is not defined. What I did was to instead ofimport 'moment';typewindow.moment = require('moment');and now calendar module works.
– JohnDoenym
Nov 23 '18 at 17:06
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430512%2fangular-js-uncaught-error-ngareq-argument-fn-is-not-a-function-got-moment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You should use angular-moment instead of the native momentjs package.
Added:import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ...but now theres another:ReferenceError: moment is not definedandTypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib
– JohnDoenym
Nov 22 '18 at 12:56
angular-momentassumes moment is global, but you are assigning momentjs to an own object namedmoment. Tryimport 'moment'instead.
– smonkey
Nov 22 '18 at 14:07
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
1
Also, angular-ui-calendar has some bug, which still causesReferenceError: moment is not defined. What I did was to instead ofimport 'moment';typewindow.moment = require('moment');and now calendar module works.
– JohnDoenym
Nov 23 '18 at 17:06
add a comment |
You should use angular-moment instead of the native momentjs package.
Added:import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ...but now theres another:ReferenceError: moment is not definedandTypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib
– JohnDoenym
Nov 22 '18 at 12:56
angular-momentassumes moment is global, but you are assigning momentjs to an own object namedmoment. Tryimport 'moment'instead.
– smonkey
Nov 22 '18 at 14:07
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
1
Also, angular-ui-calendar has some bug, which still causesReferenceError: moment is not defined. What I did was to instead ofimport 'moment';typewindow.moment = require('moment');and now calendar module works.
– JohnDoenym
Nov 23 '18 at 17:06
add a comment |
You should use angular-moment instead of the native momentjs package.
You should use angular-moment instead of the native momentjs package.
answered Nov 22 '18 at 12:06
smonkeysmonkey
665
665
Added:import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ...but now theres another:ReferenceError: moment is not definedandTypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib
– JohnDoenym
Nov 22 '18 at 12:56
angular-momentassumes moment is global, but you are assigning momentjs to an own object namedmoment. Tryimport 'moment'instead.
– smonkey
Nov 22 '18 at 14:07
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
1
Also, angular-ui-calendar has some bug, which still causesReferenceError: moment is not defined. What I did was to instead ofimport 'moment';typewindow.moment = require('moment');and now calendar module works.
– JohnDoenym
Nov 23 '18 at 17:06
add a comment |
Added:import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ...but now theres another:ReferenceError: moment is not definedandTypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib
– JohnDoenym
Nov 22 '18 at 12:56
angular-momentassumes moment is global, but you are assigning momentjs to an own object namedmoment. Tryimport 'moment'instead.
– smonkey
Nov 22 '18 at 14:07
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
1
Also, angular-ui-calendar has some bug, which still causesReferenceError: moment is not defined. What I did was to instead ofimport 'moment';typewindow.moment = require('moment');and now calendar module works.
– JohnDoenym
Nov 23 '18 at 17:06
Added:
import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ... but now theres another: ReferenceError: moment is not defined and TypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib– JohnDoenym
Nov 22 '18 at 12:56
Added:
import 'jquery/dist/jquery.js'; import moment from 'moment'; import angularMoment from 'angular-moment'; import 'fullcalendar/dist/fullcalendar.min.js'; import 'fullcalendar/dist/gcal.min.js'; import 'angular-ui-calendar/src/calendar.js'; const app = angular .module('app', [ ... 'ng-currency', angularMoment, 'ui.calendar', ... but now theres another: ReferenceError: moment is not defined and TypeError: calendar.fullCalendar is not a function, because I'm using for now demo from github.com/angular-ui/ui-calendar to test this lib– JohnDoenym
Nov 22 '18 at 12:56
angular-moment assumes moment is global, but you are assigning momentjs to an own object named moment. Try import 'moment' instead.– smonkey
Nov 22 '18 at 14:07
angular-moment assumes moment is global, but you are assigning momentjs to an own object named moment. Try import 'moment' instead.– smonkey
Nov 22 '18 at 14:07
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
Ok, had to import both moment.js and then angular-moment. Now it works.
– JohnDoenym
Nov 23 '18 at 16:32
1
1
Also, angular-ui-calendar has some bug, which still causes
ReferenceError: moment is not defined. What I did was to instead of import 'moment'; type window.moment = require('moment'); and now calendar module works.– JohnDoenym
Nov 23 '18 at 17:06
Also, angular-ui-calendar has some bug, which still causes
ReferenceError: moment is not defined. What I did was to instead of import 'moment'; type window.moment = require('moment'); and now calendar module works.– JohnDoenym
Nov 23 '18 at 17:06
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53430512%2fangular-js-uncaught-error-ngareq-argument-fn-is-not-a-function-got-moment%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown