I am developing an node app with angular2 and gulp. I have written a component file login.ts as follows:
import {Component, View} from 'angular2/angular2';
import {FormBuilder, formDirectives } from 'angular2/forms';
@Component({
selector: 'login',
injectables: [FormBuilder]
})
@View({
templateUrl: '/scripts/src/components/login/login.html',
directives: [formDirectives]
})
export class login {
}
And my bootstrap.ts file is:
import {bootstrap} from 'angular2/angular2';
import {login} from './components/login/login';
bootstrap(login);
but when I compile these files it gives me the following errors:
clientootstrap.ts(1,25): error TS2307: Cannot find module 'angular2/angular2'.
clientcomponentsloginlogin.ts(1,31): error TS2307: Cannot find module 'angular2/angular2
clientcomponentsloginlogin.ts(2,45): error TS2307: Cannot find module 'angular2/forms'.
Here is my tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"watch": true,
"removeComments": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
}
I have installed the typing for angular2 using:
tsd install angular2 --save
Please help to fix the error.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…