Bana
Bana

Reputation: 117

Angular template not part of component

In my custom component:

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

@Component({
    selector: 'app-server',
    templateURL: './server.component.html' 
})
export class ServerComponent{

}

app.module.ts

import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { FormsModule }      from '@angular/forms'; //<-- FormsModule import
import { AppComponent } from './app.component';

import { ServerComponent } from './server/server.component'; //Extension (ts) added by web pack

@NgModule({
  declarations: [
    AppComponent,
    ServerComponent
  ],
  imports: [
    BrowserModule,
    FormsModule
  ],
  providers: [],
  bootstrap: [AppComponent]
})
export class AppModule { }

Error:

/src/app/server/server.component.ts (5,2): Argument of type '{ selector: string; templateURL: string; }' is not assignable to parameter of type 'Component'.
  Object literal may only specify known properties, and 'templateURL' does not exist in type 'Component'.

Upvotes: 0

Views: 429

Answers (1)

Pankaj Parkar
Pankaj Parkar

Reputation: 136134

Typescript tooling already informed you, you had typo in templateURL

templateURL

should be

templateUrl

Upvotes: 2

Related Questions