Skip to content

JSON as single constant #47

@ericjames

Description

@ericjames

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' %>

<% }) %>}});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions