{"id":1202,"date":"2020-01-04T05:49:54","date_gmt":"2020-01-03T20:49:54","guid":{"rendered":"http:\/\/168.138.214.208\/?p=1202"},"modified":"2020-08-31T20:46:30","modified_gmt":"2020-08-31T11:46:30","slug":"post-1202","status":"publish","type":"post","link":"https:\/\/nobunobu1717.site\/?p=1202","title":{"rendered":"Angular\u3067\u74b0\u5883\u5909\u6570\u3092\u4f7f\u7528\u3059\u308b"},"content":{"rendered":"<h2>\u6982\u8981<\/h2>\n<p>Angular\u3067\u30d3\u30eb\u30c9\u74b0\u5883\u6bce\u306b\u5909\u6570\u3092\u6301\u305f\u305b\u308b\u3002<br \/>\n(\u4f8b\uff1a\u30c6\u30b9\u30c8\u7528\u3001\u672c\u756a\u7528\u306a\u3069)<br \/>\n\u7528\u9014\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u4f7f\u7528\u65b9\u6cd5\u304c\u8003\u3048\u3089\u308c\u308b\u3002<\/p>\n<p>1.API\u306e\u30a8\u30f3\u30c9\u30dc\u30a4\u30f3\u30c8\u306e\u5909\u66f4<br \/>\n2.Git\u7b49\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u7ba1\u7406\u306b\u542b\u3081\u305f\u304f\u306a\u3044APIKEY\u306a\u3069\u306e\u60c5\u5831<\/p>\n\n\t<p style=\"color:#666;margin-bottom:5px;\">\u30b9\u30dd\u30f3\u30b5\u30fc\u30ea\u30f3\u30af<\/p>\n\t<div class=\"middle-ad\">\n\t\t\t\t\t\t\t\t\t\t\t<\/div>\n\n\n<h2>\u65b9\u6cd5<\/h2>\n<h3>\u30d5\u30a1\u30a4\u30eb\u306e\u4f5c\u6210<\/h3>\n<p>src\/environments\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u4ee5\u4e0b\u306b\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f\u4e0b\u8a18\u306e2\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u304c\u5b58\u5728\u3059\u308b\u3002<\/p>\n<p>environment.prod.ts<br \/>\nenvironment.ts<\/p>\n<p>\u3053\u3053\u306b\u65b0\u3057\u3044\u74b0\u5883\u7528\u306e\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002<br \/>\n\u3053\u3053\u3067\u306flocal\u3068\u3044\u3063\u305f\u74b0\u5883\u3092\u5b9a\u7fa9\u3059\u308b\u3068\u3057\u3066\u4e0b\u8a18\u306e\u3088\u3046\u306a\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3059\u308b\u3002<\/p>\n<p>environment.local.ts<\/p>\n<h3>\u30d5\u30a1\u30a4\u30eb\u306e\u7de8\u96c6<\/h3>\n<p>\u74b0\u5883\u6bce\u306b\u8a2d\u5b9a\u3057\u305f\u3044\u5024\u3092\u5404\u30d5\u30a1\u30a4\u30eb\u306b\u8a2d\u5b9a\u3059\u308b\u3002<\/p>\n<p>environment.prod.ts<br \/>\nenvironment.ts<br \/>\nenvironment.local.ts<\/p>\n<pre class=\"lang:default decode:true \">export const environment = {\n  production: false,\n  apiurl: 'https:\/\/hoge'\n  apikey: 'hoge'\n};\n<\/pre>\n<h3>\u74b0\u5883\u5909\u6570\u306e\u53c2\u7167<\/h3>\n<p>\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u5185\u3067\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306benvironment\u3092\u30a4\u30f3\u30dd\u30fc\u30c8\u3057\u3066\u53c2\u7167\u3059\u308b\u3002<br \/>\nprod\u3084local\u306a\u3069\u306e\u74b0\u5883\u6bce\u306e\u8a2d\u5b9a\u3067\u306f\u306a\u304f\u3001environment.ts\u3092\u53c2\u7167\u3059\u308b\u4e8b\u306b\u6ce8\u610f\u3002<\/p>\n<pre class=\"lang:default decode:true \">import { environment } from '.\/..\/..\/..\/..\/environments\/environment';\n\nconsole.log(environment.apikey);\n<\/pre>\n<h3>\u30d3\u30eb\u30c9\u74b0\u5883\u306e\u8a2d\u5b9a<\/h3>\n<p>\u4f5c\u6210\u3057\u305flocal\u3068\u3044\u3063\u305f\u5b9a\u7fa9\u3092\u8a8d\u8b58\u3055\u305b\u308b\u306b\u306f\u30eb\u30fc\u30c8\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u5185\u306eangular.json\u3092\u7de8\u96c6\u3059\u308b\u3002<\/p>\n<p>build\u3068serve\u306econfigurations\u5185\u306blocal\u7528\u306e\u8a2d\u5b9a\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/p>\n<pre class=\"lang:default decode:true \">{\n  ...\n  \"projects\": {\n    \"hogeapp\": {\n      ...\n      \"architect\": {\n        \"build\": {\n          ...\n          \"configurations\": {\n            \"local\": {\n              \"fileReplacements\": [\n                {\n                  \"replace\": \"src\/environments\/environment.ts\",\n                  \"with\": \"src\/environments\/environment.local.ts\"\n                }\n              ]\n            },\n            ...\n          }\n        },\n        \"serve\": {\n          ...\n          \"configurations\": {\n            \"local\": {\n              \"browserTarget\": \"hogeapp:build:local\"\n            },\n            ...\n          }\n        },\n      ...  \n}<\/pre>\n<h3>\u30d3\u30eb\u30c9\u30b3\u30de\u30f3\u30c9\u306e\u8a2d\u5b9a<\/h3>\n<p>package.jso\u5185\u306bng serve\u3084ng build\u7528\u306e\u8a2d\u5b9a\u306b\u5909\u66f4\u3059\u308b\u3002<br \/>\nng serve -c local<br \/>\n\u3068\u3044\u3063\u305f\u5f62\u3067 -c (\u5909\u6570\u540d)\u3000\u3067\u6307\u5b9a\u304c\u53ef\u80fd\u3002<\/p>\n<pre class=\"lang:default decode:true \">{\n  ...\n  \"scripts\": {\n    \"ng\": \"ng\",\n    \"start\": \"ng serve -c local\",\n    \"build\": \"ng build --prod\",\n  },\n ...\n}\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u6982\u8981 Angular\u3067\u30d3\u30eb\u30c9\u74b0\u5883\u6bce\u306b\u5909\u6570\u3092\u6301\u305f\u305b\u308b\u3002 (\u4f8b\uff1a\u30c6\u30b9\u30c8\u7528\u3001\u672c\u756a\u7528\u306a\u3069) \u7528\u9014\u3068\u3057\u3066\u306f\u4e0b\u8a18\u306e\u3088\u3046\u306a\u4f7f\u7528\u65b9\u6cd5\u304c\u8003\u3048\u3089\u308c\u308b\u3002 1.API\u306e\u30a8\u30f3\u30c9\u30dc\u30a4\u30f3\u30c8\u306e\u5909\u66f4 2.Git\u7b49\u306e\u30bd\u30fc\u30b9\u30b3\u30fc\u30c9\u7ba1\u7406\u306b\u542b &#8230; <\/p>\n","protected":false},"author":1,"featured_media":1126,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[23,16],"tags":[],"_links":{"self":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts\/1202"}],"collection":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1202"}],"version-history":[{"count":5,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts\/1202\/revisions"}],"predecessor-version":[{"id":1465,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/posts\/1202\/revisions\/1465"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=\/wp\/v2\/media\/1126"}],"wp:attachment":[{"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1202"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1202"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nobunobu1717.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1202"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}