Topic: Angular 6 Tutorial console log issues

mdewell free asked 6 years ago


When trying to run the following code in a Windows 10 64-bit environment and a Chrome ver. 67.0.3396.99
import { Component } from '@angular/core';

  @Component({
    selector: 'mdb-root',
    templateUrl: 'app.component.html',
    styleUrls: ['app.component.css']

  })

  export class AppComponent {

    constructor(){
      this.onStartup();
    }

  onStartup(){
    console.log('Hello TS World');
  }
  }
I get an error: ERROR Error: The selector "mdb-root" did not match any elements at DefaultDomRenderer2.push../node_modules/@angular/platform-browser/fesm5/platform-browser.js.DefaultDomRenderer2.selectRootElement (platform-browser.js:1223) I am enjoying the tutorial, and would even like to help with the grammar of text write-up of it, if you want, but I want to have success going through it.

Damian Gemza staff commented 6 years ago

Dear mdewell, In @Component please change the selector from 'mdb-root' to 'app-root'. After that, it should work fine. Best Regards, Damian


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Resolved

Specification of the issue

  • ForumUser: Free
  • Premium support: No
  • Technology: MDB Angular
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags