The next step to preparing yourself for Angular 2.0 is to move from the Controller model to Component model. If you’ve had any experience with directives, you’ll see the format of what we’d use for a controller in TypeScript is similar. (I stripped out our main code, leaving what we use as a framework.) module […]
Basic Template for a TypeScript controller
After making almost 100 controllers for one system, we’ve established a standardized method for controllers. It’s not complex or exciting, but it’s saved us enough time that we decided to keep it on our site.
Angular Factories with TypeScript
To make our code as easy to maintain as possible, we keep all data interactions in modules called Factories. Most of our factory files have about 10 or 12 callback functions and we try to keep them pretty simple. Moving them to typescript wasn’t very intuitive at first, but once we figured it out, it is a no-brainer.
Here’s a basic sample that we used to get a list of offices from the api server. You can add as many functions as you want.
- « Previous Page
- 1
- …
- 3
- 4
- 5
- 6
- Next Page »