After a successful sign-up, a new company can be created by the user. We have already implemented the backend logic using Node.js, and we should be able to store the company in the companies collection in MongoDB.
Although we are discussing the create company functionality, we are going to add all the endpoints to the service:
Let's create the service file, called
jobboard/public/src/company/company.service.ts
.Import the necessary dependencies:
import { Injectable } from 'angular2/core'; import { Http, Response, Headers } from 'angular2/http'; import { AuthHttp } from '../auth/index'; import { contentHeaders } from '../common/index'; import { Company } from './company.model';
Create the
service
class:@Injectable() export class CompanyService { private _http: Http; private _authHttp: AuthHttp; }
Add the
constructor
:constructor(http: Http, authHttp: AuthHttp) { this._http = http; this._authHttp = authHttp; }
Append the
create
method:create...