当前位置: 动力学知识库 > 问答 > 编程问答 >

debugging - ngBuild Error: <component> cannot find <class-to-be-imported> (bug)?

问题描述:

 Module build failed: Error: /var/www/html/site/MyApp/src/app/StudentsComponent/students.component.ts (2,29): Cannot find module './Student/student'.)

I'm getting this error, even though the class is where it's supposed to be, and is correctly defined. Here's the class (using typescript):

import { Component, OnInit } from '@angular/core';

import { Module } from './Module/module';

import { ModulaUser } from './ModulaUser/modula-user';

export class Student extends ModulaUser {

/* parent class members

public modulaUserId:String;

public userFirst:String;

public userLast:String;

public userStatus:String;

public schoolCode:String;

public eMail:String; */

public studentUserId: String;

public firstName: String;

public lastName: String;

public activeModule: Module;

public completedModules: ModulePerformance[];

constructor(profile, modulePerformance:ModulePerformance[]){

super(profile);

this.studentUserId = profile.username;

this.firstName = profile.user_first;

this.lastName = profile.user_last;

this.activeModule = modulePerformance.then( mods => mods.find( mod => mod.module_id === profile.current_module));

completedModules = modulePerformance;

}

constructor(profile, modulePerfService: ModulePerformanceService){

super(profile);

this.studentUserId = profile.username;

this.firstName = profile.user_first;

this.lastName = profile.user_last;

activeModule = modulePerfService.getActiveModule(studentUserId)

completeModules = modulePerfService.getModPerformance(studentUserId);

}

}

The error is thrown in several similar situations, where the path is relative to the top-level of the angular-cli installation in 'src', i.e., 'App/scr/app'. Is this some kind of bug in the latest release (v1.0.0-beta.22) or is polymorphism non-existent in angular 2?

分享给朋友:
您可能感兴趣的文章:
随机阅读: