I have two angular with typescript projects, and I want one module (namespace in fact) to be available for both.
In project one, I have a module with a controller and a service. I want this functionality available in my second project, without copying the code.
Is it as simple as exporting the module and injecting it as a dependency on my new project?
I have tried this solution, but I have not succeeded. This is my code:
/// <reference path="../../typings/index.d.ts"/>
namespace Controllers {
"use strict";
export class ExampleCtrl {
public static $inject: Array<string> = [];
private attrs;
constructor() {
// Stuff here
}
// Public and private methods, here
}
angular.module("app.exampleCtrl").controller("ExampleCtrl", Controllers.ExampleCtrl);
}
How can I access this controller in my second project? I try this:
import {ExampleCtrl} from "../../directory/ExampleCtrl";
But TS linter shows an error that the module is not found.