我已经开始使用我的第一个角度应用程序。它运行在一个asp.net MVC应用程序中。在asp mvc + angular应用程序中不显示角度组件模板
当我写的index.html <my-app></my-app>
,它不显示我的组件的模板。我怎么解决这个问题?
import { Component } from '@angular/core';
@Component({
selector: 'my-app',
template: `<h1>Hello {{name}}</h1>`,
})
export class AppComponent { name = 'Angular'; }
ngmudol:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppComponent } from './app.component';
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
将您的NgModule添加到问题 –
@BabarBilal我编辑问题 – Kianoush
@Kianoush如果您已经完成了这些操作,请在AppModule的引导位置添加代码。以下是基本的Angular App助力增强示例:https://toddmotto.com/bootstrap-angular-2-hello-world –