0

I am just beginning with Angular. When I try to run my angular app, it just shows a blank page and on inspecting it I find the app-root is empty. So I opened the app.component.ts file and find some error there

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

@Component({
    selector: 'app-root',
    templateUrl: './app.component.html',
    styleUrls:['./app.component.scss']
})
export class AppComponent {
  title = 'My Angular App';
}

Here at the component directive the error says

Argument of type '{ selector: string; templateUrl: string; styleUrls: string[]; }' is not assignable to parameter of type 'Component'.
Property 'true' is missing in type '{ selector: string; templateUrl: string; styleUrls: string[]; }'.

I didnt understand what I did wrong. Angular version 7

1
  • My guess is your cache isn't clean. Close your IDE, delete node_modules, npm cache clean, and npm install fresh is your best bet from here w/o more info. Other info needed would be the HTML where you have the <app-root></app-root> and the app-root html itself. Make sure you have all the imports in your app-module. Look at the app-root HTML and make sure all other components used in it are imported in it's module. Commented Jun 12, 2019 at 12:53

1 Answer 1

0

the problem is there

I think you don't use the correct import, declaretion in app.module.

Sign up to request clarification or add additional context in comments.

3 Comments

But that ts file declaration is autogenerated when I created the application itself. Thats why I am wondering. Angular CLI created the code and it has error?
@SandeepThomas, No. It's most likely with IDE and node_modules in your workspace. Try to install fresh and restart your IDE.
Sorry since Im a new to Angular.. What are the main things to uninstall? Angular CLI or Node/NPM itself?

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.