Angular 以ng显示角度2中的列表
我更新到angular 2我写了显示电影列表的代码,但它显示了一个错误,请检查我的代码 下面是我的代码 component.ts:文件Angular 以ng显示角度2中的列表,angular,Angular,我更新到angular 2我写了显示电影列表的代码,但它显示了一个错误,请检查我的代码 下面是我的代码 component.ts:文件 import { Component} from '@angular/core'; @Component({ selector:'my-app', template:`<h1>welcome to my shop</h1> <p>we have the following movies available</
import { Component} from '@angular/core';
@Component({
selector:'my-app',
template:`<h1>welcome to my shop</h1>
<p>we have the following movies available</p>
<div>
<p *ngfor=#movie of movieList>{{movie}}</p>
</div>`
})
export class MyShopComponent{
public movieList=['batman vs superman','civil war','deadpool']
}
内部组件模板
ngFor
应使用let
定义当前iterable变量。还可以通过“
使用包装属性将*ngfor
的打字错误更正为*ngfor
{{movie}
内部组件模板
ngFor
应使用let
来定义当前的iterable变量。还应将*ngFor
的打字错误更正为*ngFor
,并通过包装属性“
{{movie}
请给出你方对学习英语的任何建议2@balajiunnam请访问,相信我,他们提供了很好的文档。请给我你方对学习的任何建议2@balajiunnam请访问,相信我,他们提供了良好的文档。。
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { FormsModule } from '@angular/forms';
import { MyShopComponent } from './app.component';
@NgModule({
imports: [
BrowserModule,
FormsModule
],
declarations: [
MyShopComponent
],
bootstrap: [ MyShopComponent ]
})
export class AppModule { }
<p *ngFor="let movie of movieList">{{movie}}</p>