How to include this circular-json plugin in our Angular 4 application
PrithiviRajG opened this issue · 2 comments
PrithiviRajG commented
I am getting circular JSON exception on catching the error logs so I am trying to use this in my project which is developed in angular 4. Please help us to add this in our project.
WebReflection commented
It’s a node module. Can’t you just import it? I’ve no idea about Angular 4
PrithiviRajG commented
I am able to use this in our Angular 4 project after few struggles. I will add the instructions for Angular 4 implementation below so others can use it if they struck like me.
- Run
npm install --save circular-json
command in your project to install circular-json - Run
npm install --save @types/circular-json
command in your project. These are Type definition files which provide better experience when using JS libraries with auto completion and type checking - Add
import * as CircularJSON from 'circular-json';
in the top of your component or service where your want to use circular-json - Get the string of your circular-json with this code
let error : string = CircularJSON.stringify(err);
Thanks for this wonderful plugin :)