Slide 41
Slide 41 text
@Injectable
import {Injectable} from 'ng-metadata/core'
import { Hero } from './hero';
@Injectable()
export class HeroesService {
get() {
return [
new Hero(1, 'Windstorm'),
new Hero(2, 'Spiderman'),
];
}
}
import {
Component,OnInit,HostBinding,Inject
} from 'ng-metadata/core'
@Component({
selector: 'my-heroes',
template: `...`
})
export class HeroesComponent implements OnInit {
@HostBinding('attr.role') role = 'widget';
constructor(
private heroesSvc: HeroesService,
@Inject('$log') private $log: ng.ILogService
) {}
ngOnInit(){
this.$log.log( this.heroesSvc.get() );