Skip to content
This repository has been archived by the owner on Feb 9, 2020. It is now read-only.

build 1.5.0-build.4376+sha.aff74ec and batarang #279

Closed
SanderElias opened this issue Nov 7, 2015 · 8 comments
Closed

build 1.5.0-build.4376+sha.aff74ec and batarang #279

SanderElias opened this issue Nov 7, 2015 · 8 comments

Comments

@SanderElias
Copy link

If you use the .component helper form this build, and you have batarang active, the following error will be thrown.

script.js:8 Uncaught TypeError: angular.module(...).component is not a function

Took me some time to figure out what was happening...
Disable batarang, and your component(s) start working!

Posted here also as sugessted in #13275

@Narretz
Copy link
Contributor

Narretz commented Nov 9, 2015

@btford @SomeKittens Do you know what could be causing this? I assume batarang decorates the angular.Module functions / or provides its own implementation, and .component isn't yet part of that.

@SomeKittens
Copy link
Member

@Narretz Yep, that'd be the first place to look. I've got some time, checking into this

@SomeKittens
Copy link
Member

Here's the relevant code:

angular.module = function(name, requiresOriginal) {
  var module = originalAngularModule.apply(this, arguments),
      name = module.name;

  module.requiresOriginal = requiresOriginal;
  modules[name] = module;
  var modToCheck = getModule(name, true);
  //check arguments to determine if called as setter or getter
  var modIsSetter = arguments.length > 1;

  if (modIsSetter) {
    hasNameSpace(name);
  }

  if(modToCheck && modToCheck.requiresOriginal !== module.requiresOriginal && modIsSetter) {
    if(!modData.createdMulti[name]) {
      modData.createdMulti[name] = [getModule(name,true)];
    }
    modData.createdMulti[name].push(module);
  }
  modData.createdModules[name] = module;
  return module;
};

Since we're returning the result of a call to the original module function, I'm going to punt this back over the fence.

@SanderElias
Copy link
Author

hmm. probably .component will get attached later, as it is an extension on .directive. It seems batarang gets in between there. I wonder how that could happen. One would think that those things are handed around per reference.

@gkalpak
Copy link
Member

gkalpak commented Nov 10, 2015

I still think the problem is within Batarang. It is somehow defining window.angular I think, so it is already defined when setupModuleLoader() is executed, thus our factory function is never called.

Will have to take a closer look to make sure, though.

@gkalpak
Copy link
Member

gkalpak commented Nov 10, 2015

Hm...yes, Batarang seems to have it's own loader (to retain compatibility with v1.2.x ?).
So, it needs to get updated to include .component I guess.

I'm punting this ba...ehm...re-opening this for further investigation 😃

@gkalpak gkalpak reopened this Nov 10, 2015
@SomeKittens
Copy link
Member

Well, I never was very good at football anyway.

Yep, that's us, need to fix that loader. Completely forgot about it.

@SomeKittens
Copy link
Member

y'know what? Double my bad - this is a dupe of #275

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

No branches or pull requests

4 participants