Iamisti
Iamisti

Reputation: 1710

AngularJS and modularisation

AngularJs provides you the possibility to create modules. All fine. It also give you the power to add components to your modules like service, controller, etc...

My only problem with that is that no matter in what module did you define a component, from another module it can be entirely overwritten.

Examples:

app.module('aModule').controller('SimpleController', functino(){...});
app.module('bModule').controller('SimpleController', functino(){...});

If you try to define let's say a state definiction with ui-router, it will just won't work well, since one controller will completely overwrite the one loaded first.

Did you guys met with this problem too or it's just me?

Upvotes: 4

Views: 55

Answers (1)

Maarten
Maarten

Reputation: 4671

no, that's normal behavior. You can namespace it like 'component.controller' (so do this in the name of the controller, not the module) which helps, other then that is not possible in Angular 1

Upvotes: 2

Related Questions