25 lines
459 B
TypeScript
25 lines
459 B
TypeScript
|
// #docregion
|
||
|
import { Component, OnInit } from '@angular/core';
|
||
|
|
||
|
import { AdService } from './ad.service';
|
||
|
import { AdItem } from './ad-item';
|
||
|
|
||
|
@Component({
|
||
|
selector: 'my-app',
|
||
|
template: `
|
||
|
<div>
|
||
|
<add-banner [ads]="ads"></add-banner>
|
||
|
</div>
|
||
|
`
|
||
|
})
|
||
|
export class AppComponent implements OnInit {
|
||
|
ads: AdItem[];
|
||
|
|
||
|
constructor(private adService: AdService) {}
|
||
|
|
||
|
ngOnInit() {
|
||
|
this.ads = this.adService.getAds();
|
||
|
}
|
||
|
}
|
||
|
|