I cloned https://github.com/vladotesanovic/angular2-express-starter in my project for explore angular2 and express.
What I want to is just "Hello World" level, so it looks complicated I deleted every files in modules folder.
and I deleted injecting modules in app.modules.ts file.
so my app.modules.ts is below :
import { NgModule, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { provideAuth } from "angular2-jwt";
import { HttpModule } from "@angular/http";
import { NgSemanticModule } from "ng-semantic";
import { AppComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
HttpModule,
NgSemanticModule,
],
providers: [
provideAuth({
globalHeaders: [{"Content-type": "application/json"}],
newJwtError: true,
noTokenScheme: true
})
],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ],
schemas: [
CUSTOM_ELEMENTS_SCHEMA
]
})
export class AppModule {}
as you can see, there is no other module in imports and declarations.
and I edit app.component.ts, the root component. like below:
import { Component, ViewChild } from "@angular/core";
import "rxjs/add/operator/map";
@Component({
selector: "app",
template: `<h1> Hello Angular 2 </h1>`
})
export class AppComponent {
}
What I expected just showing "Hello Angular 2".
but the browser still request deleted page. the component was deleted. Where and why angular2 request that file?
Is my way wrong? I am having problem since yesterday, It looks very difficult to setting.
try removing providers
from app.module.ts
:
providers: [
provideAuth({
globalHeaders: [{"Content-type": "application/json"}],
newJwtError: true,
noTokenScheme: true
})
]
our authService is implemented in home.component.ts
( https://github.com/vladotesanovic/angular2-express-starter/blob/master/client/modules/home/home.component.ts ) and it's being called.
What does index.html look like? It must contain the "app" tag
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.