我正在尝试新的 Angular 2 Forms。我的导入语句如下:
import {bootstrap, onChange, NgIf, Component, Directive, View, Ancestor} from 'angular2/angular2';
import {formDirectives, NgControl, Validators, NgForm} from 'angular2/forms';
import {RegExpWrapper, print, isPresent} from 'angular2/src/facade/lang';
import {reflector} from 'angular2/src/reflection/reflection';
import {ReflectionCapabilities} from 'angular2/src/reflection/reflection_capabilities';
'angular2/angular2' 可以很好地解析,但其他“ from
”位置都没有解析。错误是:
找不到模块“angular2/forms”。
所有这些组件当前都在我的node_modules
目录中。如果我输入完整路径:
import {formDirectives, ControlDirective, Validators, TemplateDrivenFormDirective} from 'C:/Users/Deb/node_modules/angular2/forms';
然后它工作。但是,我不需要使用完整路径。设置 tsconfig 时是否遗漏了某些内容,或者还有其他问题?