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

JSON as single constant #47

Open
ericjames opened this issue Jul 6, 2017 · 1 comment
Open

JSON as single constant #47

ericjames opened this issue Jul 6, 2017 · 1 comment

Comments

@ericjames
Copy link

ericjames commented Jul 6, 2017

Just FYI for future users, my use case was converting a JSON dictionary into a single app constant. My flow was using a gulp module to create a json file which then is converted into Angular constant.

Thanks for providing the EJS template ability to customize the output.

angular.module("<%- moduleName %>"<% if (deps) { %>,${JSON.stringify(deps)}<% } %>)
${indent}.constant({"myDictionary": {

<% constants.forEach(function(constant) { %>
"<%- constant.name %>": ${constant.value},
<%= _.last(constants) === constant ? '' : '\n' %>

<% }) %>}});
@ViieeS
Copy link

ViieeS commented Nov 17, 2017

@ericjames I found EJS templating solution too complicated for this purpose.

Look at my solution: #38 (comment)

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