找不到
名称“模块”。您是否需要为节点安装类型定义?尝试npm i @types/node
,然后将node
添加到tsconfig的类型字段中。
答案 0 :(得分:1)
尝试一下
npm i @types/node --save-dev
答案 1 :(得分:0)
import { Component } from '@angular/core';
import { Router } from '@angular/router';
import { AlertService, UserService } from '../_services/index';
@Component({
moduleId: module.id,
templateUrl: 'register.component.html'
})
export class RegisterComponent {
model: any = {};
loading = false;
constructor(
private router: Router,
private userService: UserService,
private alertService: AlertService) { }
register() {
this.loading = true;
this.userService.create(this.model)
.subscribe(
data => {
this.alertService.success('Registration successful', true);
this.router.navigate(['/login']);
},
error => {
this.alertService.error(error);
this.loading = false;
});
}
}
The above is my code where it is showing "Cannot find name module" error...