i am using nested component in angular2.
My file structure as follows
--app
--student
--student.component.css
--studnet.component.ts
--student.component.html
--studnet.component.spec.ts
--app.component.ts
--app.component.html
--app.component.css
--app.component.spec.ts
My app.componet.ts code as follows
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
//templateUrl: './app.component.html'
template: `
<div>
/<h1>{{pageheader}}</h1>
</div>
<my-student></my-student>
`,
})
export class AppComponent {
pageheader: string = "Student Details"
}
app.studnet.ts code as follows
import { Component } from "@angular/core"
//decorater declaration
@Component({
selector: 'my-student',
templateUrl : 'app/app.component.html'
})
//class creation
export class StudentComponent {
firstName: string = "Karthik";
lastName: string = "Elumalai";
gender: string = "Male";
qualification: string = "MCA";
}
app.module.ts code as follows
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import { StudentComponent } from './app.student'
//import {AppComponent} from './app.student'
@NgModule({
declarations: [
AppComponent,
StudentComponent
],
imports: [
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
when i runt the above code shows error
ERROR in ./src/app/app.student.ts
Module not found: Error: Can't resolve './app/app.student.html' in
'C:\Users\190
0055\my-studentnestedcomponent\src\app'
resolve './app/app.student.html' in
'C:\Users\1900055\my-studentnestedcomponent\
src\app'
using description file:
C:\Users\1900055\my-studentnestedcomponent\package.jso
n (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
--
You received this message because you are subscribed to the Google Groups
"Angular and AngularJS discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.