Currently in my angular2 Project, I am utilizing grunt for automating the compilation of my typescript files.
Everything seems to be working fine as my files are compiling, but I keep encountering errors:
app/webapp/ng2/audit_logs/auditLogs.ts(2,3): error TS2304: Cannot find name 'app'.
app/webapp/ng2/audit_logs/auditLogs.ts(3,3): error TS2304: Cannot find name 'http'.
app/webapp/ng2/audit_logs/auditLogs.ts(3,10): error TS2304: Cannot find name 'ng'.
app/webapp/ng2/audit_logs/auditLogs.ts(6,3): error TS2304: Cannot find name 'app'.
app/webapp/ng2/audit_logs/auditLogs.ts(7,5): error TS2304: Cannot find name 'ng'.
app/webapp/ng2/main.ts(16,24): error TS2304: Cannot find name 'upgradeAdapter'.
I have attempted using Definetlytyped without success.
I'm at a loss as to why this is happening?
Please assist me in rectifying this. Below are my main.ts and auditLogs.ts
files for you to review and pinpoint where the issue lies.
Main.ts file
/// <reference path="../../../node_modules/angular2/typings/browser.d.ts" />
var window: any = {
giddh: undefined
};
import {UpgradeAdapter} from 'angular2/upgrade';
var adapter = new UpgradeAdapter();
var app = window.giddh.webApp;
adapter.bootstrap(document.body, ['giddhWebApp']);
// downgrade ng2 components to ng1 directives
app.directive('myApp', upgradeAdapter.downgradeNg2Component(app.AppComponent));
auditLogs.ts file
(function(giddh: any) {
app = giddh.webApp
http = ng.http
app.AppComponent =
ng.core.Component({
selector: 'my-app',
templateUrl: ''
}).Class({
constructor: function(http: any) {
this.test = new test(1020);
}
});
class test {
val: string;
constructor(data: any){
this.val = data;
}
}
})(window.giddh || (window.giddh = {}));
var window: any = {
giddh: undefined
}
declare var require: any;
import {Component} from 'angular2/core';
@Component({
selector: 'my-app',
template: '/public/webapp/ng2/audit_logs/audit-logs.html'
})
export class AppComponent {
}