1

My vscode shows error in the line Cannot find the module and highlights CreateTaskComponent line of app.module.ts

My code

app.module.ts

import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';

import { AppComponent }  from './app.component';
import { CreateTaskComponent} from './app/taskList/create-task.component';
@NgModule({
  imports: [ BrowserModule ],
  declarations: [ AppComponent, CreateTaskComponent ],
  bootstrap: [ AppComponent ]
})
export class AppModule { }

create-task.component.ts

import {Component} from '@angular/core';
@Component({
    selector:'create-task',
    templateUrl: 'app/taskList/create-task.component.html'

})
export class CreateTaskComponent{
        pageTitle : string ='Create a Task';

}

Folder structure is

enter image description here

1 Answer 1

6

As your app.module already there in app folder, you can directly navigate through taskList folder.

import { CreateTaskComponent} from './taskList/create-task.component';

OR

import { CreateTaskComponent} from './../app/taskList/create-task.component';
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks Pankaj! Basic one. didnt catch it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.