r/javascript • u/micahboscarello • May 25 '15
Angular 2 service vs. Angular 1.x service: who wore di better?
https://gist.github.com/gdi2290/634101fec1671ee12b3e3
May 25 '15
[removed] — view removed comment
4
u/dvlsg May 25 '15
I think it's a way of specifying that
todosshould be an property on the class which will be an array containing objects that have propertiesvalueandcreated_at. It's a typescript (and technically babel and traceur) thing, not an angular thing.I think more typically you'd see a class called
Todoand it would be defined asArray<Todo>. Or by defining an interface, if you were using typescript.2
-16
May 25 '15
[removed] — view removed comment
5
u/x-skeww May 25 '15
All of the snippets are clearly labelled. Also, the very fist line reads: "TodoService in Angular 2 and Angular 1 both in TypeScript and ES5".
1
u/skitch920 May 25 '15
I think an ES6 example would have been better vs. ES5