I have an angular application, written in typescript whose config registration was just getting out of control, and huge - it took up about 3 pages.
So I broke it up into multiple config(fn) sections, and moved as much logic out of that page as I could and encapsulated specific behaviors into their own classes; it seemed like the smart way to go about cleaning it up.
each of the new classes looks something like this;
namespace config {
export class http {
constructor($httpProvider: ng.IHttpProvider){
// $httpProvider configuration
}
}
}
so back in my main.ts, the file that creates my module and registers everything, I import them over.
import { http } from './config/http';
import { router } from ./config/router';
// etc.
but the namespace doesn't seem to be a part of this. I cannot call them such as...
config(config.http)
config(config.router)
// etc.
I've had to instead give them new alias when bringing them in;
import { http as configHttp } from './config/http';
import { router as configRouter } from './config/router';
// etc.
Why is this? Is there anything I can do to keep the namespace definition intact and use the simpler method I was aiming for?