Created
February 10, 2017 22:58
-
-
Save zrod/504c3bf8d21ab4ffe9d11bf6d2e5286d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from '@angular/core' | |
@Component({ | |
selector: 'app', | |
template: ` | |
<div> | |
<h2>Hello {{name}}</h2> | |
</div> | |
`, | |
}) | |
export class AppComponent { | |
name:string; | |
constructor() { | |
this.name = 'Angular2' | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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