In the initial chapters, we grouped our files by their domain context. We did things a bit differently this time to highlight the fact that you can also start with a more flat approach. And, if necessary, you can start grouping your files based on their domain context instead of their type.
Still, we are going to group our components based on their context in order to locate them faster. Also imagine that you can load the whole application into a different application, and having a flatter folder structure will reduce the unnecessary navigation hassle.
We are going to start with a simple service that will handle all of the user application logic. Create a new file called public/src/services/user.service.ts
with the following code:
import { Injectable } from 'angular2/core'; import { Http, Response, Headers } from 'angular2/http'; import { Observable } from 'rxjs/Observable'; import { contentHeaders } from '../common/headers'; import { User } from '../datatypes...