Creating a new company
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.
The company service
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() ...
Get Web Application Development with MEAN now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.