How this can improve my code? How it can remove dependency ? I still don't see any benefit of using this ?
@Component({
selector: 'talk-list',
templateUrl: 'talks.html',
providers: [TalksAppBackend]
})
class TalkList {
constructor(backend:TalksAppBackend) {
this.talks = backend.fetchTalks();
}
}
If i had used
TalksAppBackend t= new TalksAppBackend(); that would have been the same. Apart from syntactical difference how different it is?
Update:
Also, it's calling .fetchTalks(); that's not mocking. How its possible?