{"_id":"55fd9c6e56d6990d00a6caa2","category":{"_id":"55fd9c6e56d6990d00a6caa0","version":"55fd9c6d56d6990d00a6ca9d","__v":1,"project":"54d64e6b276f8e0d00feab95","pages":["55fd9c6e56d6990d00a6caa1","55fd9c6e56d6990d00a6caa2","55fd9c6e56d6990d00a6caa3","55fd9c6e56d6990d00a6caa4","55fd9c6e56d6990d00a6caa5","55fd9c6e56d6990d00a6caa6","55fd9c6e56d6990d00a6caa7","55fd9c6e56d6990d00a6caa8"],"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-07T18:14:40.771Z","from_sync":false,"order":2,"slug":"your-application","title":"Your Application"},"project":"54d64e6b276f8e0d00feab95","user":"54d64e31276f8e0d00feab94","version":{"_id":"55fd9c6d56d6990d00a6ca9d","project":"54d64e6b276f8e0d00feab95","__v":1,"createdAt":"2015-09-19T17:33:33.368Z","releaseDate":"2015-09-19T17:33:33.368Z","categories":["55fd9c6e56d6990d00a6ca9e","55fd9c6e56d6990d00a6ca9f","55fd9c6e56d6990d00a6caa0"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"1.4.0","version":"1.4.0"},"__v":1,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-02-07T17:50:58.426Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":1,"body":"We put some nice default files which you can use in your application right away.\n\n# Environments\nNew applications come with two default environments in `environments.json` file:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"development\\\": {\\n    \\\"ENV\\\": \\\"development\\\",\\n    \\\"API_URL\\\": \\\"http://localhost:3000\\\"\\n  },\\n\\n  \\\"production\\\": {\\n    \\\"ENV\\\": \\\"production\\\",\\n    \\\"API_URL\\\": \\\"http://example.com\\\"\\n  }\\n}\",\n      \"language\": \"json\",\n      \"name\": \"environments.json\"\n    }\n  ]\n}\n[/block]\nBoth the default `ENV` and `API_URL` keys are registered as AngularJS constants, so you can inject and use them right away in your controllers and services. You can always add more environment variables. In that case, you may want to use `:::at:::@VAR_NAME` to replace it according to selected environment when running your app locally and building it.\n\n# Directives\nYou can use `ifEnv` directive to show/hide html depending on your current environment. You can also inject `ENV` constant to any service or controller to run code that depends on environment.\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"<div if-env=”development”>\\n  <!-- some markup that will not be shown on production -->\\n  <!-- for example, conversion pixels or analytics tracking -->\\n</div>\",\n      \"language\": \"html\"\n    }\n  ]\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"class HomeController {\\n  constructor (ENV) {\\n\\t\\tif (ENV === 'production') {\\n      // Some production-only code;\\n    }\\n  }\\n}\",\n      \"language\": \"javascript\"\n    }\n  ]\n}\n[/block]\n# Filters\nAdd some useful filter\n\n# States\nYou can use static state for all the static pages for your app. To generate static states you should run:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ kick generate state static/faq\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]\nor many static states as once:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$ kick generate state static faq terms about contact-us\",\n      \"language\": \"shell\"\n    }\n  ]\n}\n[/block]","excerpt":"","slug":"handy-defaults","type":"basic","title":"Handy Defaults"}
We put some nice default files which you can use in your application right away. # Environments New applications come with two default environments in `environments.json` file: [block:code] { "codes": [ { "code": "{\n \"development\": {\n \"ENV\": \"development\",\n \"API_URL\": \"http://localhost:3000\"\n },\n\n \"production\": {\n \"ENV\": \"production\",\n \"API_URL\": \"http://example.com\"\n }\n}", "language": "json", "name": "environments.json" } ] } [/block] Both the default `ENV` and `API_URL` keys are registered as AngularJS constants, so you can inject and use them right away in your controllers and services. You can always add more environment variables. In that case, you may want to use `@@VAR_NAME` to replace it according to selected environment when running your app locally and building it. # Directives You can use `ifEnv` directive to show/hide html depending on your current environment. You can also inject `ENV` constant to any service or controller to run code that depends on environment. [block:code] { "codes": [ { "code": "<div if-env=”development”>\n <!-- some markup that will not be shown on production -->\n <!-- for example, conversion pixels or analytics tracking -->\n</div>", "language": "html" } ] } [/block] [block:code] { "codes": [ { "code": "class HomeController {\n constructor (ENV) {\n\t\tif (ENV === 'production') {\n // Some production-only code;\n }\n }\n}", "language": "javascript" } ] } [/block] # Filters Add some useful filter # States You can use static state for all the static pages for your app. To generate static states you should run: [block:code] { "codes": [ { "code": "$ kick generate state static/faq", "language": "shell" } ] } [/block] or many static states as once: [block:code] { "codes": [ { "code": "$ kick generate state static faq terms about contact-us", "language": "shell" } ] } [/block]