Closed arkdelkaos closed 8 years ago
What does importing ngtweet
return? (console.log
it). I'm guessing it's returning an object with a name
property, and is globally registering the Angular module. If so, include ngtweet.name
in your dependency array instead.
Ok, I think I have found it...but...I don't know why! xD
(...)
import 'ngtweet';
import 'angular-ui-scrollpoint';
(...)
angular.module('eecrApp', [
ngCookies, ngResource, ngSanitize, 'btford.socket-io', uiRouter, uiBootstrap,
'ui.scrollpoint', 'ngtweet',
(...)
What its the difference between then and now? O__o
Look at the signature of angular.module
. More directly, you can look at the Angular injector's loadModules
function definition.
The first thing it looks for is a module name (String), which would be created by the dependency.
Else, if it's a function or an array, it will make providers from them.
Else, it runs assertArgFn(module, 'module');
, which is where your 'not a function, got object' error comes from. (checks that the arg is a function)
Basically the angular.module
requires
array parameter takes either strings or functions. Which is returned by importing your module completely depends on the module.
Ok, understood :) Thanks, as always! :)
[QUESTION]
Its going to be easy ;)
I'm having trouble loading modules; I always got this error:
Error: [ng:areq] Argument 'module' is not a function, got Object
I know I'm doing it wrong, but I don't know exactly what it's failing.
For example, lets say I want to use [https://github.com/arusahni/ngtweet]
npm install --save ngtweet
...then , atwebpack.make.js
, I add the module to the build entry:...then, at
app.js
:Seeing that I cannot make it work with any of the modules I'm installing with npm, what I'm doing wrong?
I'm sure is kind of obvious, but I can't get it to work :(