I am currently in the process of converting a simple Angular 1.6 project to TypeScript. I have declared all the necessary typings dependencies and they have been compiled and installed successfully. However, I am encountering a compilation error stating "Cannot find namespace 'ng'" in my service file. The Angular name is also not being recognized.
Here is a screenshot for reference
Here is the content of tsconfig.json:
{
"files": [
"app/**/*.ts",
"app/**/*.js",
"main.js",
"renderer.js"
],
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"declaration": false,
"noImplicitAny": false,
"allowJs": false,
"rootDir": ".",
"typeRoots": ["./typings"]
}
}
The contents of typings.json are as follows:
{
"dependencies": {
"angular": "registry:dt/angular#1.6.0+20170321201455"
},
"globalDependencies": {
"jquery": "registry:dt/jquery#1.10.0+20170310222111"
}
}
Lastly, here is an excerpt from the service.ts file:
module Services {
export interface IMyService {
}
export class MyService {
http: ng.IHttpService;
location: ng.ILocationService;
constructor($http: ng.IHttpService, $location: ng.ILocationService) {
this.http = $http;
this.location = $location;
}
}
}