I need to implement 3rd party rest API in php project for integrating another project which is in angular.
Using rest API, I need to store cookie in the browser and cookie value will be in a specific format as instructed for which I need to import a specific npm package called angular2-cookie inside my root directory from
https://github.com/salemdar/angular2-cookie/blob/master/src/services/cookies.service.ts
I successfully installed it using npm command inside root directory.
In /js/sample-script.js
I imported the specific cookies.service.js file from that angular2-cookie module using browserify lib like
var CookieService = require('../node_modules/angular2-cookie/services/cookies.service');
var cs = new CookieService();
cs.putObject('somecookie',{user: 'john'});
but in the console, I am getting an error like:
Uncaught TypeError: CookieService is not a constructor
How can I implement putObject method from CookieService prototype?
Note: There is no error coming till 1st line where I used require method