Skip to content

Instantly share code, notes, and snippets.

@zrod
Created February 10, 2017 22:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zrod/504c3bf8d21ab4ffe9d11bf6d2e5286d to your computer and use it in GitHub Desktop.
Save zrod/504c3bf8d21ab4ffe9d11bf6d2e5286d to your computer and use it in GitHub Desktop.
import { Component } from '@angular/core'
@Component({
selector: 'app',
template: `
<div>
<h2>Hello {{name}}</h2>
</div>
`,
})
export class AppComponent {
name:string;
constructor() {
this.name = 'Angular2'
}
}
import { Component, NgModule } from '@angular/core'
import { BrowserModule } from '@angular/platform-browser'
import { AppComponent } from './app.component'
import { OtherComponent } from './other.component'
@NgModule({
imports: [ BrowserModule ],
declarations: [ AppComponent, OtherComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule {}
import { Component } from '@angular/core'
@Component({
moduleId: module.id,
selector: 'others',
template: `
<div>
<h2>Yada</h2>
<div *ngFor="let item of items">
<h2>{item.title}</h2>
</div>
</div>
`
})
export class OtherComponent {
items:array;
constructor() {
this.items = [
{
title: 'ABC'
},
{
title: 'XYZ'
}
];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment