Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use this package in Angular 4 Application ? #11

Open
RaviGprec opened this issue Oct 16, 2018 · 1 comment
Open

How to use this package in Angular 4 Application ? #11

RaviGprec opened this issue Oct 16, 2018 · 1 comment

Comments

@RaviGprec
Copy link

Simply const safeJsonStringify = require('safe-json-stringify'); doesn't work in Angular 4. Because we have import statements in Angular 2, 4+ vesrion.
require() is not supported any more. If stringify is exported as class then we can import that class in Angular 4.

Could you tell me "Is it supported for this Angular 4 application ?". If yes, tell me how to use it.

Thanks inadvance!!

@gmaughan
Copy link

gmaughan commented Mar 4, 2020

If it is still relevant for you, the following works for me:

import * as safeJsonStringify from 'safe-json-stringify';

const s = safeJsonStringify(obj);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants