Created
January 30, 2018 10:21
-
-
Save ismcagdas/355f10c589313c600cfafa856aba5e59 to your computer and use it in GitHub Desktop.
Acme.HeroShop - app.component.ts - 3
This file contains 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, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent implements OnInit { | |
title = 'app'; | |
heroCompanies: any = []; | |
heroes: any = []; | |
ngOnInit(): void { | |
this.heroCompanies = [ | |
{ | |
id: 1, | |
name: 'Marvel Studios' | |
}, { | |
id: 2, | |
name: 'DC Comics' | |
}]; | |
this.heroes = [ | |
{ | |
id: 1, | |
name: 'Spider-Man', | |
heroCompanyId: 1 | |
}, | |
{ | |
id: 2, | |
name: 'Hulk', | |
heroCompanyId: 1 | |
}, | |
{ | |
id: 3, | |
name: 'The-Flash', | |
heroCompanyId: 2 | |
} | |
]; | |
} | |
filterHeroes(heroCompanyId: number): void { | |
//todo: ger heroes from server here... | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment