找不到模块'angular2 / angular2“ [英] Cannot find module 'angular2/angular2'
本文介绍了找不到模块'angular2 / angular2“的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我发展与angular2和吞咽的节点应用程序。我已经写了一个组件文件login.ts休耕:
I am developing an node app with angular2 and gulp. I have wrote a components file login.ts as fallow:
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 {
}
和我bootstrap.ts文件
and my bootstrap.ts file as
import {bootstrap} from 'angular2/angular2';
import {login} from './components/login/login';
bootstrap(login);
但我当我编译这些文件时,它给我的错误
but i when i compile these file it giving me error
client\bootstrap.ts(1,25): error TS2307: Cannot find module 'angular2/angular2'.
client\components\login\login.ts(1,31): error TS2307: Cannot find module 'angular2/angular2
client\components\login\login.ts(2,45): error TS2307: Cannot find module 'angular2/forms'.
这是我的tsconfig.json
here is my tsconfig.json
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"sourceMap": true,
"watch": true,
"removeComments": true,
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true
}
}
我在使用安装angular2打字
I have install the typing for angular2 using
tsd install angular2 --save
请帮忙纠正它。
推荐答案
yups是进口。但对更多进口我已经张贴了这个答案可能是这是对别人太有用了。
yups as said by @simon error is in imports. but for further imports i have posted this answer may be this is useful for others too.
import {Component, View, Directive, Input, Output, Inject, Injectable, provide} from 'angular2/core';
import {bootstrap} from 'angular2/platform/browser';
import {CORE_DIRECTIVES, FORM_DIRECTIVES, NgClass, NgIf NgForm, Control, ControlGroup, FormBuilder, Validators} from 'angular2/common';
import {RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, Router, LocationStrategy, HashLocationStrategy} from 'angular2/router';
import {Http, HTTP_PROVIDERS, RequestOptions, Headers, Request, RequestMethod} from 'angular2/http'
这篇关于找不到模块'angular2 / angular2“的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文