I am pretty new to Angular.JS and Typescript and try to use them together but I am stuck at a point, which should not be a problem for most of you.
Is successfully made route with a view and a controller.
This works perfectly if they are in the some file like this.
var collabClientApp = angular.module('collabClientApp', ['ui.router']);
console.log("started routing");
collabClientApp.config(function ($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise("/projects");
$stateProvider
.state('projects', {
url: "/projects",
templateUrl: "views/projects.html",
controller: "ProjectListController"
})
});
collabClientApp.controller("ProjectListController",
function ProjectListController($scope) {
$scope.projects = projects;
}
);
Then I tried to move the controller to a separate file like this:
/// <reference path="../controllers.ts"/>
/// <reference path="../collabClientApp.ts"/>
"use strict";
collabClientApp.controller("ProjectListController",
function ProjectListController($scope) {
$scope.projects = projects;
});
collabClientApp.ts is the name of the file which does the routing. I get the following message:
Uncaught ReferenceError: collabClientApp is not defined
The reference part is correct, so collabClientApp should be found in the controller-file. Or do I miss something?
Help is very much appreciated.