Hacker News new | ask | show | jobs
by xeromal 3565 days ago
It's super easy to write a component in ng2. I feel like it's faster, but it's been about a year since I really used ng1.

My favorite thing about ng2 components over ng1 would be the annotations. One annotation turns my component into a component. It links the html template, sets up the services, injects the other components and directives it needs in one simple annotation. In ng1, I remember it being cumbersome to set everything up.

To use a component in your existing app. You create a new ts file. Add an annotation. Write the template inline or in another file. Reference that ts class in your other components. That's it!