<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>Programming is Fun</title>
    <link>https://netframework.tistory.com/</link>
    <description>Still waters run deep. When the well's dry, we know the worth of water. </description>
    <language>ko</language>
    <pubDate>Sun, 10 May 2026 17:48:31 +0900</pubDate>
    <generator>TISTORY</generator>
    <ttl>100</ttl>
    <managingEditor>Y2K</managingEditor>
    <image>
      <title>Programming is Fun</title>
      <url>https://t1.daumcdn.net/cfile/tistory/162C3F284A19E94C43</url>
      <link>https://netframework.tistory.com</link>
    </image>
    <item>
      <title>Gradle 5.0에서의 querydsl Q-class 생성</title>
      <link>https://netframework.tistory.com/entry/Gradle-50%EC%97%90%EC%84%9C%EC%9D%98-querydsl-Qclass-%EC%83%9D%EC%84%B1</link>
      <description>&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;gradle이 major update를 할 때마다 querydsl Q-class들의 생성방법이 계속해서 바뀌고 있습니다. 이제는 좀 더 자연스러운 방법으로 처리가 되네요. 더 이상 추가 task를 만들 필요없이 지원이 가능합니다.&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;변경된&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;build.gradle&lt;/code&gt;입니다.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;lombok&lt;/code&gt;과&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;querydsl&lt;/code&gt;을 모두 적용한 상태입니다.&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; overflow: auto; font: 400 13.6px/1.45 Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; margin-top: 0px; margin-bottom: 16px; padding: 16px; background-color: rgb(247, 247, 247); border-radius: 3px; overflow-wrap: normal; color: rgb(51, 51, 51); letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;code class=&quot;hljs language-groovy&quot; style=&quot;box-sizing: border-box; display: inline; background: transparent; padding: 0px; color: rgb(51, 51, 51); overflow: initial; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; font-style: normal; font-variant: normal; font-weight: normal; font-stretch: normal; line-height: inherit; margin: 0px; border-radius: 3px; word-break: normal; white-space: pre; border: 0px; max-width: initial; overflow-wrap: normal;&quot;&gt;dependencies {
    annotationProcessor(
            &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: rgb(223, 80, 0);&quot;&gt;&quot;com.querydsl:querydsl-apt:${rootProject.ext.querydslVersion}:jpa&quot;&lt;/span&gt;,
            &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: rgb(223, 80, 0);&quot;&gt;&quot;org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.2.Final&quot;&lt;/span&gt;,
            &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: rgb(223, 80, 0);&quot;&gt;&quot;javax.annotation:javax.annotation-api:1.3.2&quot;&lt;/span&gt;,
            &lt;span class=&quot;hljs-string&quot; style=&quot;box-sizing: border-box; color: rgb(223, 80, 0);&quot;&gt;&quot;org.projectlombok:lombok&quot;&lt;/span&gt;
    )
}

sourceSets {
    main.java.srcDirs += [ generated ]
}

tasks.withType(JavaCompile) {
    options.annotationProcessorGeneratedSourcesDirectory = file(generated)
}

clean.doLast {
    file(generated).deleteDir()
}
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;간단한 설명입니다.&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;annotationProcessor&lt;/code&gt;는 compile시의&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;annotationProcessor&lt;/code&gt;를 gradle에서 자동으로 추가해줍니다. 이때 사용되는 각각의&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;jar&lt;/code&gt;를 추가해주면 됩니다. 기존의&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;generateQueryDsl&lt;/code&gt;을 전혀 할 필요가 없습니다. 다음&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;JavaCompile&lt;/code&gt;환경에 생성될&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;Q-class&lt;/code&gt;들의 위치를 지정해주고 그 위치를&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;sourceSets&lt;/code&gt;에 추가합니다. 마지막으로&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;clean&lt;/code&gt;으로 생성된&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;Q-class&lt;/code&gt;들을 제거해주는 코드를 넣어줍니다.&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 0px; margin-bottom: 16px; color: rgb(51, 51, 51); font-family: &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Segoe UI&amp;quot;, Arial, freesans, sans-serif; font-size: 16px; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration-style: initial; text-decoration-color: initial;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;gradle&lt;/code&gt;에서&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;annotationProcessor&lt;/code&gt;를 지원함으로서 더욱 편하게&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;box-sizing: border-box; font: 13.6px Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;QueryDsl&lt;/code&gt;을 지원할 수 있게 되었습니다.&lt;/p&gt;</description>
      <category>Java</category>
      <category>gradle</category>
      <category>java</category>
      <category>JPA</category>
      <category>queryDSL</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/462</guid>
      <comments>https://netframework.tistory.com/entry/Gradle-50%EC%97%90%EC%84%9C%EC%9D%98-querydsl-Qclass-%EC%83%9D%EC%84%B1#entry462comment</comments>
      <pubDate>Thu, 29 Nov 2018 16:33:35 +0900</pubDate>
    </item>
    <item>
      <title>PKI 시스템</title>
      <link>https://netframework.tistory.com/entry/PKI-%EC%8B%9C%EC%8A%A4%ED%85%9C</link>
      <description>&lt;article id=&quot;markdown&quot; class=&quot;markdown-body&quot; style=&quot;box-sizing: border-box; min-width: 200px; max-width: 980px; margin: 0px auto; padding: 45px; text-size-adjust: 100%; color: rgb(51, 51, 51); font-family: -apple-system, BlinkMacSystemFont, &amp;quot;Segoe UI&amp;quot;, Roboto, Helvetica, Arial, sans-serif, &amp;quot;Apple Color Emoji&amp;quot;, &amp;quot;Segoe UI Emoji&amp;quot;, &amp;quot;Segoe UI Symbol&amp;quot;; font-size: medium; line-height: 1.5; word-wrap: break-word;&quot;&gt;&lt;h1 style=&quot;box-sizing: border-box; font-size: 2em; margin-right: 0px; margin-bottom: 16px; margin-left: 0px; line-height: 1.25; padding-bottom: 0.3em; border-bottom: 1px solid rgb(238, 238, 238); margin-top: 0px !important;&quot;&gt;PKI&lt;/h1&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;PKI에 대해서 정리할 필요성이 있어서 정리하게 되었습니다.&lt;span id=&quot;instant-markdown-cursor&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;이론&lt;/h3&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;RFC 2459에 정의 (Internet X.509 Public Key Infrastructure)&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;암호화와 복호화를 위해 서로 다른 키를 사용하는 방식(비대칭 암호화방식)에서 사용되는 key 기반&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;암호화를 위해 사용되는 Key:&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;Public Key&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;복호화를 위해 사용되는 Key:&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;Private Key&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;Message Digest&lt;/h3&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;메세지 축약(message digest) - MD5(128bit), SHA1(160bit), SHA256&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;아무리 긴 내용이라도 축약시키는 것이 가능&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;Symmetric Key Algorithm&lt;/h3&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;OneKey - Symmetric Key를 이용해서 Encrypt와 Decrypt를 진행&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;속도가 빠르다.&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;3DES, AES&lt;/li&gt;&lt;/ul&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;Asymmetric Key Algorithm&lt;/h3&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;&quot;&gt;Two Key (PrivateKey, PublicKey)&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;&quot;&gt;리만가설에 근거&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;&quot;&gt;RSA&lt;/p&gt;&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;&lt;p style=&quot;box-sizing: border-box; margin-top: 16px; margin-bottom: 16px;&quot;&gt;공개키 암호화/복호화&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;PlainText --(Public Key)--&amp;gt; EncryptedText
EncryptedText --(Private Key)--&amp;gt; PlainText
&lt;/code&gt;&lt;/pre&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;서명/확인 (Sign/Verify)&lt;/li&gt;&lt;/ul&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;PlainText --(Private Key)--&amp;gt; SignedValue
SignedValue --(Public Key)--&amp;gt; PlainText
&lt;/code&gt;&lt;/pre&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;PKI&lt;/h3&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;Asymmetric Key Algorithm&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;Private Key, Public Key를 이용&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;Private Key는 충분히 보호받고, 외부에 노출되지 않는 상황&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;Public Key는 항시 노출이 가능한 상황&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;PrivateKey를 가진 상대방만 볼 수 있는 내용을 전달하고 싶은 경우에는 암호화/복호화(Encrypt/Decrypt)&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;PrivateKey를 가진 사람이 보낸 내용임을 확인하기 위한 방법이 서명/확인(Sign/Verify)&lt;/li&gt;&lt;/ul&gt;&lt;h1 style=&quot;box-sizing: border-box; font-size: 2em; margin: 24px 0px 16px; line-height: 1.25; padding-bottom: 0.3em; border-bottom: 1px solid rgb(238, 238, 238);&quot;&gt;OpenSSL&lt;/h1&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;OpenSource로 PKI를 지원&lt;/p&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;Private Key/Public Key 생성&lt;/h3&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;#private key 생성
openssl genrsa -out server.private.pem 2048 

#(option) private key를 사용할 때 필요한 암호 제거
openssl rsa -in server.private.pem -out server.private.pem 

#private key와 쌍이 되는 public key 생성
openssl rsa -in server.private.pem -pubout -out server.public.pem 
&lt;/code&gt;&lt;/pre&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;Key 파일 형식&lt;/h3&gt;&lt;ul style=&quot;box-sizing: border-box; padding-left: 2em; margin-top: 0px; margin-bottom: 16px;&quot;&gt;&lt;li style=&quot;box-sizing: border-box;&quot;&gt;pem(Privacy Enhanced Mail): byte data를 Base64 HEX String으로 변경시켜서 가독성이 있도록 만든 Format&lt;/li&gt;&lt;li style=&quot;box-sizing: border-box; margin-top: 0.25em;&quot;&gt;der(Distinguished Encoding Rules): byte data. Browser에서 사용되는 기본 형식&lt;/li&gt;&lt;/ul&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;#DER -&amp;gt; PEM (private key)
openssl rsa -inform DER -outform PEM -in server.private.der -out server.private.pem 

#PEM -&amp;gt; DER (private key)
openssl rsa -inform PEM -outform DER -in server.private.pem -out server.private.der 
&lt;/code&gt;&lt;/pre&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;#DER -&amp;gt; PEM (public key)
openssl rsa -inform DER -outform PEM -pubin -in server.public.der -out server.public.pem 

#PEM -&amp;gt; DER (public key)
openssl rsa -inform PEM -outform DER -pubin -in server.public.pem -out server.public.der 
&lt;/code&gt;&lt;/pre&gt;&lt;h3 style=&quot;box-sizing: border-box; margin-top: 24px; margin-bottom: 16px; font-size: 1.25em; line-height: 1.25;&quot;&gt;서버인증서&lt;/h3&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;HTTPS를 지원하기 위해서는 서버에 대한 인증서를 요청해야지 됩니다. 인증된 기간이 요청서를 인증을 하게 되면 그것이 인증서가 됩니다.&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;1.요청서 작성&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;#요청서 작성
openssl req -new -days 500 -key server.private.pem -out server.csr 
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;2.요청서를 CA가 서명&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;#요청서를 CA가 서명
openssl x509 -req -days 500 -in server.csr -signkey ca.private.pem -out server.crt 
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;3.(option) PFX 파일&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;comodo등에서는 pfx파일이 주로 사용됩니다.&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;pfx&lt;/code&gt;는&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;crt&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;server.private.pem&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;server.public.pem&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;ca.public.pem&lt;/code&gt;이 결합되어 있는 형태입니다.&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;PFX = 요청서 + 서버PrivateKey + 서버PublicKey + CaPublicKey
&lt;/code&gt;&lt;/pre&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 16px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;#CA 개인키와 요청서와 서버 요청서 결합 (password 연결)
openssl pkcs12 -export -in server.crt -inkey ca.private.pem -out server.pfx 

#PFX 파일에서 server의 private key 추출
openssl pkcs12 -in server.pfx -nocerts -nodes -out server.private.pem 

#PFX 파일에서 server 요청서 추출
openssl pkcs12 -in server.pfx -clcerts -nokeys -out server.crt 
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;4.(option) JKS(java key store)&lt;/p&gt;&lt;p style=&quot;box-sizing: border-box; margin-bottom: 16px;&quot;&gt;JKS 파일은 pfx를 통해서 얻어낼 수 있으며,&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;server.private.pem&lt;/code&gt;과&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;server.public.pem&lt;/code&gt;을 모두 얻어낼 수 있습니다. java의&amp;nbsp;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0px; margin: 0px; background-color: rgba(0, 0, 0, 0.04); border-radius: 3px;&quot;&gt;keytool&lt;/code&gt;을 이용합니다.&lt;/p&gt;&lt;pre style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; font-stretch: normal; line-height: 1.45; word-wrap: normal; padding: 16px; overflow: auto; background-color: rgb(247, 247, 247); border-radius: 3px; margin-bottom: 0px !important;&quot;&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;keytool -importkeystore -srckeystore server.pfx -srcstoretype pkcs12 -destkeystore server.jks -deststoretype jks
&lt;/code&gt;&lt;/pre&gt;&lt;div&gt;&lt;code style=&quot;box-sizing: border-box; font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Menlo, Courier, monospace; font-size: 13.6px; padding: 0px; margin: 0px; background: transparent; border-radius: 3px; word-break: normal; border: 0px; display: inline; overflow: visible; line-height: inherit; word-wrap: normal;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;&lt;/article&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</description>
      <category>Java</category>
      <category>PKI</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/457</guid>
      <comments>https://netframework.tistory.com/entry/PKI-%EC%8B%9C%EC%8A%A4%ED%85%9C#entry457comment</comments>
      <pubDate>Thu, 13 Jul 2017 10:12:52 +0900</pubDate>
    </item>
    <item>
      <title>nodejs, pm2, git을 이용한 Dockfile 구성</title>
      <link>https://netframework.tistory.com/entry/nodejs-pm2-git%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-Dockfile-%EA%B5%AC%EC%84%B1</link>
      <description>&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;nodejs + pm2 application을 구성한&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;dockfile&lt;/code&gt;을 구성하는 방법에 대해서 알아보도록 하겠습니다.&lt;/p&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;먼저 code를 어떤 방법으로 배포할지에 대한 process를 정하는 것이 중요합니다. 이는&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;Dockerfile&lt;/code&gt;을 어떻게 만들지에 대한 방향이 결정나게 됩니다.&lt;/p&gt;&lt;h2 id=&quot;process&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;배포 Process&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;제가 구성한 Docker를 이용한 배포 process는 다음과 같습니다.&lt;/p&gt;&lt;ol style=&quot;margin: 15px 0px; padding: 0px 0px 0px 30px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;nvm&lt;/code&gt;&amp;nbsp;설치&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;nvm&lt;/code&gt;을 이용한 node 설치&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;pm2&lt;/code&gt;&amp;nbsp;설치&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;ssh&lt;/code&gt;&amp;nbsp;인증 +&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;git clone&lt;/code&gt;&amp;nbsp;을 통한 code download&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;npm install&lt;/code&gt;&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;.pm2/logs&lt;/code&gt;&amp;nbsp;위치에 따른 host 파일 공유&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;docker run&lt;/code&gt;의 parameter pass를 통한&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;pm2&lt;/code&gt;&amp;nbsp;start json 파일 전송&lt;/li&gt;&lt;/ol&gt;&lt;h2 id=&quot;1-nvm-node-pm2&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;1. nvm 설치 &amp;amp; node 설치 &amp;amp; pm2 설치&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;ubuntu&lt;/code&gt;&amp;nbsp;image를 기본으로 하여 구성을 하도록 하겠습니다.&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;nodejs&lt;/code&gt;&amp;nbsp;application은&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;npm install&lt;/code&gt;을 통해서&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;node_modules&lt;/code&gt;을 다운로드 받아서 compile되는 환경이기 때문에 build환경역시 갖추는 것이 중요합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;FROM&lt;/span&gt; ubuntu

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# 빌드 환경 구성&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;apt-get update
&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;apt-get install -y wget build-essential keychain git python 
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# NVM_DIR, NODE_VERSION에 따른 ENV 설정&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; NVM_DIR /usr/local/nvm
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; NODE_VERSION &lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;7.3&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# NVM 다운로드 &amp;amp; 설치&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# Shell 변경 (sh -&amp;gt; bash)&lt;/span&gt;
SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;]

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# nvm 구성 &amp;amp; node install&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;span class=&quot;hljs-built_in&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$NVM_DIR&lt;/span&gt;/nvm.sh; \
    nvm install &lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$NODE_VERSION&lt;/span&gt;; \
    nvm use --delete-prefix &lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$NODE_VERSION&lt;/span&gt;;
&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# PM2 설치&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;npm install -g pm2
&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;2-ssh&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;2. ssh 인증 구성&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;ssh 인증을 위해서&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;private key&lt;/code&gt;를&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;image&lt;/code&gt;안에&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;COPY&lt;/code&gt;할 필요가 있습니다. 그리고&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;$(ssh-agent)&lt;/code&gt;값을 지정해줄 필요가 있습니다. 그런데,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;eval&lt;/code&gt;을 이용한 값 설정의 경우,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;Dockerfile&lt;/code&gt;에서 할 수 없습니다. 따라서&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;do-ssh.sh&lt;/code&gt;&amp;nbsp;실행 파일을 구성해서 처리할 image 내부에서 실행할 필요가 있습니다.&lt;/p&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;다음은&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;do-ssh.sh&lt;/code&gt;파일의 내용입니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-built_in&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;eval&lt;/span&gt; &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;&lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$(ssh-agent)&lt;/span&gt;&quot;&lt;/span&gt; &amp;amp;&amp;amp; ssh-agent &lt;span class=&quot;hljs-_&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;-s&lt;/span&gt;
ssh-add /root/.ssh/id_rsa
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# .ssh Folder작성 &amp;amp; private key Copy&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;mkdir /root/.ssh
&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;COPY&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[ &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;id_rsa&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;/root/.ssh/id_rsa&quot;&lt;/span&gt; ]
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# SSH Key 권한 설정 - 권한이 600이 아닌경우, id_rsa key를 얻어내지 못합니다.&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;chmod 600 /root/.ssh/id_rsa
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# do-ssh.sh 파일 COPY&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;COPY&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[ &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;do-ssh.sh&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;/root/do-ssh.sh&quot;&lt;/span&gt; ]
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# 실행권한 설정&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;chmod 777 /root/&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;do&lt;/span&gt;-ssh.sh
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# SHELL 변경 (bash -&amp;gt; sh)&lt;/span&gt;
SHELL [&quot;/bin/sh&quot;, &quot;-c&quot;]
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# do-ssh.sh RUN&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/root/&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;do&lt;/span&gt;-ssh.sh
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# SSH 접근 check. -o StrictHostKeyChecking=no option이 없으면 docker container에서 실행되지 않습니다.&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;ssh -T -v git@10.1.95.184 -o StrictHostKeyChecking=no
&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;3-git-code-download-npm-install&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;3. git code download &amp;amp; npm install&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;nodejs Application이 위치될 folder를 만들어주고,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;git clone&lt;/code&gt;을 통해서 code를 받고,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;npm install&lt;/code&gt;을 하는 구성입니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# apps folder 작성&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;mkdir /apps
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# Shell 변경 (sh -&amp;gt; bash)&lt;/span&gt;
SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;]
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;WORKDIR&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/apps
&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;git &lt;span class=&quot;hljs-built_in&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;clone&lt;/span&gt; git@10.1.95.184:/home/git/repo/fms-api-v2.git -o StrictHostKeyChecking=no
&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;WORKDIR&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/apps/fms-api-v2
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# npm 설치 &lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;npm install
&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;npm install&lt;/code&gt;을 통해서 필요한 node module들을 모두 받아주고 build과정을 거치게 됩니다.&lt;/p&gt;&lt;h2 id=&quot;4-port-pm2-log-volume&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;4. PORT 공유 &amp;amp; PM2 Log volume 구성&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;제가 만든 application은 5000, 8000번 port를 open시켜서 사용합니다. 사용되는 PORT를&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;EXPOSE&lt;/code&gt;&amp;nbsp;시켜주는 과정이 필요하게 됩니다. 그리고&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;pm2&lt;/code&gt;의 log 파일을 host에 기록하도록 volume을 추가합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# expose 5000, 8000 port&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;EXPOSE&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;8000&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;EXPOSE&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;5000&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# VOLUME 설정 pm2 log folder&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;VOLUME&lt;/span&gt;  &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/root/.pm2/logs
&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;5&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;5. 뒷처리과정&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;매우매우 위험한 파일을 container에 넣어둔것을 기억하고 있어야지됩니다. private key가 바로 그것이지요. 꼭 이 파일을 지워주는 과정이 필요합니다. 마지막으로&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;pm2&lt;/code&gt;&amp;nbsp;실행에 대한&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;ENTRYPOINT&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;CMD&lt;/code&gt;&amp;nbsp;설정이 필요합니다. 제가 만든 application은 설정&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;json&lt;/code&gt;파일에 따라서 동작환경이 변경되게 됩니다. 설정&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;json&lt;/code&gt;파일을 외부에서 parameter로 넣어줄 수 있도록 설정해주는 것이 필요합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# Private Key 삭제&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;rm /root/.ssh/id_rsa
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# ENTRYPOINT 설정 docker container에서 pm2를 실행시킬때는 pm2-docker를 통해서 실행합니다.&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENTRYPOINT&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[ &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;pm2-docker&quot;&lt;/span&gt; ]
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# CMD 설정 - parameter가 없는 경우, default 값을 지정하게 됩니다. &lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;CMD&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[&lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;pm2/dev-system.json&quot;&lt;/span&gt;]
&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;6-build-image-docker-run&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;6. build image &amp;amp; docker run&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;image를 만들기 위해서,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;docker build&lt;/code&gt;를 다음과 같이 구성합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;docker build -t nodejs-pm2-application .
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;이제 process가 진행되면&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;nodejs-pm2-application&lt;/code&gt;으로 image가 만들어지게 됩니다.&lt;/p&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;만들어진 image를 이용해서 container를 배포하는 명령어는 다음과 같습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;docker run -it --name node-app -p 5000:5000 -p 8000:8000 -v /logs/pm2:/root/.pm2/logs -t nodejs-pm2-application pm2/api-system1.json
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;ul style=&quot;margin: 15px 0px; padding: 0px 0px 0px 30px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;-p&lt;/code&gt;&amp;nbsp;option으로 5000, 8000번 port를 host에 연결합니다.&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;-v&lt;/code&gt;&amp;nbsp;options으로&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;/root/.pm2/logs&lt;/code&gt;&amp;nbsp;folder를 host의&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;/logs/pm2&lt;/code&gt;로 mount 시킵니다.&lt;/li&gt;&lt;li style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;마지막에 command로&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;/pm2/api-system1.json&lt;/code&gt;을 넣어 container의 COMMAND를&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;pm2-docker pm2/api-system1.json&lt;/code&gt;으로 변경시킵니다.&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;summary&quot; style=&quot;margin: 20px 0px 10px; padding: 0px; border-width: 0px 0px 1px; border-top-style: initial; border-right-style: initial; border-bottom-style: solid; border-left-style: initial; border-top-color: initial; border-right-color: initial; border-bottom-color: rgb(204, 204, 204); border-left-color: initial; border-image: initial; -webkit-font-smoothing: antialiased; font-size: 24px; font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif;&quot;&gt;SUMMARY&lt;/h2&gt;&lt;p style=&quot;margin: 10px 0px 15px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;Dockerfile을 구성하는 것은 Application의 형태에 따라, 개발환경에 따라 많은 차이를 가지고 오게 됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;nodejs&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;python&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;ruby&lt;/code&gt;와 같이 외부 library를 받아 compile하는 과정을 가지게 된다면 image내부에서 code를 직접 git으로 받아올 필요가 있습니다. 그러나,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;JAVA&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;C#&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;GO&lt;/code&gt;와 같이 universal compile이 되는 경우, Docker image를 만들때, compile시켜&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;ADD&lt;/code&gt;를 통해서 실행파일을 image안에 넣는것이 더 좋을것 같습니다.&lt;/p&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;다음은 전체&amp;nbsp;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: 1px solid rgb(234, 234, 234); white-space: nowrap; background-color: rgb(248, 248, 248); border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;Dockerfile&lt;/code&gt;입니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;margin-top: 15px; margin-bottom: 15px; padding: 0.5em; border: 1px solid rgb(204, 204, 204); font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; background-color: rgb(248, 248, 248); line-height: 19px; overflow: auto; border-radius: 3px; color: rgb(77, 77, 76);&quot;&gt;&lt;code style=&quot;font-family: Consolas, &amp;quot;Liberation Mono&amp;quot;, Courier, monospace; font-size: 12px; line-height: 19px; margin: 0px; padding: 0px; border: none; background: transparent; border-radius: 3px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;margin: 0px; padding: 16px; border: 0px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;FROM&lt;/span&gt; ubuntu

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# 빌드 환경 구성&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;apt-get update
&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;apt-get install -y wget build-essential keychain git python 
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# NVM_DIR, NODE_VERSION에 따른 ENV 설정&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; NVM_DIR /usr/local/nvm
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; NODE_VERSION &lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;7.3&lt;/span&gt;.&lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;0&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# NVM 다운로드 &amp;amp; 설치&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.32.1/install.sh | bash
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# Shell 변경 (sh -&amp;gt; bash)&lt;/span&gt;
SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;]

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# nvm 구성 &amp;amp; node install&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;&lt;span class=&quot;hljs-built_in&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;source&lt;/span&gt; &lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$NVM_DIR&lt;/span&gt;/nvm.sh; \
    nvm install &lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$NODE_VERSION&lt;/span&gt;; \
    nvm use --delete-prefix &lt;span class=&quot;hljs-variable&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(200, 40, 41);&quot;&gt;$NODE_VERSION&lt;/span&gt;;
&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; NODE_PATH $NVM_DIR/v$NODE_VERSION/lib/node_modules
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENV&lt;/span&gt; PATH $NVM_DIR/versions/node/v$NODE_VERSION/bin:$PATH

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# PM2 설치&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;npm install -g pm2
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# .ssh Folder작성 &amp;amp; private key Copy&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;mkdir /root/.ssh
&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;COPY&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[ &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;id_rsa&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;/root/.ssh/id_rsa&quot;&lt;/span&gt; ]
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# SSH Key 권한 설정 - 권한이 600이 아닌경우, id_rsa key를 얻어내지 못합니다.&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;chmod 600 /root/.ssh/id_rsa
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# do-ssh.sh 파일 COPY&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;COPY&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[ &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;do-ssh.sh&quot;&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;/root/do-ssh.sh&quot;&lt;/span&gt; ]
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# 실행권한 설정&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;chmod 777 /root/&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;do&lt;/span&gt;-ssh.sh
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# SHELL 변경 (bash -&amp;gt; sh)&lt;/span&gt;
SHELL [&quot;/bin/sh&quot;, &quot;-c&quot;]
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# do-ssh.sh RUN&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/root/&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;do&lt;/span&gt;-ssh.sh
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# SSH 접근 check. -o StrictHostKeyChecking=no option이 없으면 docker container에서 실행되지 않습니다.&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;ssh -T -v git@10.1.95.184 -o StrictHostKeyChecking=no
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# apps folder 작성&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;mkdir /apps
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# Shell 변경 (sh -&amp;gt; bash)&lt;/span&gt;
SHELL [&quot;/bin/bash&quot;, &quot;-c&quot;]
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;WORKDIR&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/apps
&lt;/span&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;git &lt;span class=&quot;hljs-built_in&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;clone&lt;/span&gt; git@10.1.95.184:/home/git/repo/fms-api-v2.git -o StrictHostKeyChecking=no
&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;WORKDIR&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/apps/fms-api-v2
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# npm 설치 &lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;npm install
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# expose 5000, 8000 port&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;EXPOSE&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;8000&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;EXPOSE&lt;/span&gt; &lt;span class=&quot;hljs-number&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(245, 135, 31);&quot;&gt;5000&lt;/span&gt;

&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# VOLUME 설정 pm2 log folder&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;VOLUME&lt;/span&gt;  &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;/root/.pm2/logs
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# Private Key 삭제&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;RUN&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;rm /root/.ssh/id_rsa
&lt;/span&gt;
&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# ENTRYPOINT 설정 docker container에서 pm2를 실행시킬때는 pm2-docker를 통해서 실행합니다.&lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;ENTRYPOINT&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[ &lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;pm2-docker&quot;&lt;/span&gt; ]
&lt;/span&gt;&lt;span class=&quot;hljs-comment&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(142, 144, 140);&quot;&gt;# CMD 설정 - parameter가 없는 경우, default 값을 지정하게 됩니다. &lt;/span&gt;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(137, 89, 168);&quot;&gt;CMD&lt;/span&gt; &lt;span class=&quot;bash&quot; style=&quot;margin: 0px; padding: 0px; border: 0px;&quot;&gt;[&lt;span class=&quot;hljs-string&quot; style=&quot;margin: 0px; padding: 0px; border: 0px; color: rgb(113, 140, 0);&quot;&gt;&quot;pm2/dev-system.json&quot;&lt;/span&gt;]
&lt;/span&gt;&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin: 15px 0px; padding: 0px; border: 0px; color: rgb(30, 30, 30); font-family: Helvetica, arial, freesans, clean, &amp;quot;Malgun Gothic&amp;quot;, sans-serif; font-size: 14px;&quot;&gt;Happy Coding~&lt;/p&gt;</description>
      <category>nodejs</category>
      <category>docker</category>
      <category>Nodejs</category>
      <category>publish</category>
      <category>SSH</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/456</guid>
      <comments>https://netframework.tistory.com/entry/nodejs-pm2-git%EC%9D%84-%EC%9D%B4%EC%9A%A9%ED%95%9C-Dockfile-%EA%B5%AC%EC%84%B1#entry456comment</comments>
      <pubDate>Mon, 26 Dec 2016 08:59:37 +0900</pubDate>
    </item>
    <item>
      <title>gradle 정리 - queryDSL code generate (v 4.x)</title>
      <link>https://netframework.tistory.com/entry/gradle-%EC%A0%95%EB%A6%AC-queryDSL-code-generate-v-4x</link>
      <description>&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px;&quot;&gt;queryDSL이 4.x대로 변경이 되면서 package명에 큰 변화가 생겼습니다. 기존&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;com.mysema.querydsl&lt;/code&gt;&amp;nbsp;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;com.querydsl&lt;/code&gt;로 package명이 바뀌어서 간략화 되었지요.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px;&quot;&gt;기존 querydsl 처리 부분에 대한 build.gradle을 변경한다면 다음과 같습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre style=&quot;background-color:#2b2b2b;color:#a9b7c6;font-family:'PragmataPro';font-size:10.6pt;&quot;&gt;dependencies {&lt;br /&gt;    compile(&lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;org.springframework.boot:spring-boot-starter-web&quot;&lt;/span&gt;) {&lt;br /&gt;        exclude &lt;span style=&quot;color:#6a8759;&quot;&gt;module&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;spring-boot-starter-tomcat&quot;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;}&lt;br /&gt;    compile &lt;span style=&quot;color:#6a8759;&quot;&gt;'com.graphql-java:graphql-java:2.1.0'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile(&lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;org.springframework.boot:spring-boot-starter-jetty&quot;&lt;/span&gt;)&lt;br /&gt;    compile(&lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;org.springframework.boot:spring-boot-starter-actuator&quot;&lt;/span&gt;)&lt;br /&gt;    testCompile(&lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;junit:junit&quot;&lt;/span&gt;)&lt;br /&gt;    testCompile(&lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;org.springframework.boot:spring-boot-starter-test&quot;&lt;/span&gt;)&lt;br /&gt;    compile &lt;span style=&quot;color:#6a8759;&quot;&gt;'com.querydsl:querydsl-apt:4.1.4'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;'com.querydsl:querydsl-jpa:4.1.4'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;'org.springframework.data:spring-data-jpa:1.10.4.RELEASE'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;group&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'org.hibernate'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;name&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'hibernate-core'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;version&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'5.2.3.Final'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;org.hibernate:hibernate-entitymanager:5.2.3.Final&quot;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;'com.h2database:h2:1.4.187'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;group&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'org.aspectj'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;name&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'aspectjrt'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;version&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'1.8.9'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compile &lt;span style=&quot;color:#6a8759;&quot;&gt;group&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'org.aspectj'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;name&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'aspectjweaver'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;version&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'1.8.9'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;compileOnly &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;org.projectlombok:lombok:1.16.12&quot;&lt;br /&gt;&lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sourceSets {&lt;br /&gt;    main {&lt;br /&gt;        java {&lt;br /&gt;            srcDirs &lt;span style=&quot;color:#6a8759;&quot;&gt;'src/main/java'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;'src/main/generated'&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;        &lt;/span&gt;}&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;task generateQueryDSL(&lt;span style=&quot;color:#6a8759;&quot;&gt;type&lt;/span&gt;: JavaCompile, &lt;span style=&quot;color:#6a8759;&quot;&gt;group&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'build'&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;description&lt;/span&gt;: &lt;span style=&quot;color:#6a8759;&quot;&gt;'Generates the QueryDSL query types'&lt;/span&gt;) {&lt;br /&gt;    file(&lt;span style=&quot;color:#cc7832;&quot;&gt;new &lt;/span&gt;File(&lt;span style=&quot;color:#9876aa;&quot;&gt;projectDir&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;/src/main/generated&quot;&lt;/span&gt;)).deleteDir()&lt;br /&gt;    file(&lt;span style=&quot;color:#cc7832;&quot;&gt;new &lt;/span&gt;File(&lt;span style=&quot;color:#9876aa;&quot;&gt;projectDir&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;/src/main/generated&quot;&lt;/span&gt;)).mkdirs()&lt;br /&gt;    &lt;span style=&quot;color:#9876aa;&quot;&gt;source &lt;/span&gt;= &lt;span style=&quot;color:#9876aa;&quot;&gt;sourceSets&lt;/span&gt;.&lt;span style=&quot;color:#6a8759;&quot;&gt;main&lt;/span&gt;.&lt;span style=&quot;color:#808080;&quot;&gt;java&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#808080;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color:#9876aa;&quot;&gt;classpath &lt;/span&gt;= &lt;span style=&quot;color:#9876aa;&quot;&gt;configurations&lt;/span&gt;.&lt;span style=&quot;color:#6a8759;&quot;&gt;compile &lt;/span&gt;+ &lt;span style=&quot;color:#9876aa;&quot;&gt;configurations&lt;/span&gt;.&lt;span style=&quot;color:#6a8759;&quot;&gt;compileOnly&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color:#808080;&quot;&gt;options&lt;/span&gt;.compilerArgs = [&lt;br /&gt;            &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;-proc:only&quot;&lt;/span&gt;,&lt;br /&gt;            &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;-processor&quot;&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;com.querydsl.apt.jpa.JPAAnnotationProcessor&quot;&lt;br /&gt;&lt;/span&gt;&lt;span style=&quot;color:#6a8759;&quot;&gt;    &lt;/span&gt;]&lt;br /&gt;    &lt;span style=&quot;color:#9876aa;&quot;&gt;destinationDir &lt;/span&gt;= file(&lt;span style=&quot;color:#6a8759;&quot;&gt;'src/main/generated'&lt;/span&gt;)&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;compileJava {&lt;br /&gt;    dependsOn &lt;span style=&quot;color:#808080;&quot;&gt;generateQueryDSL&lt;br /&gt;&lt;/span&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style=&quot;color:#9876aa;&quot;&gt;clean&lt;/span&gt;.doLast {&lt;br /&gt;    file(&lt;span style=&quot;color:#cc7832;&quot;&gt;new &lt;/span&gt;File(&lt;span style=&quot;color:#9876aa;&quot;&gt;projectDir&lt;/span&gt;, &lt;span style=&quot;color:#6a8759;&quot;&gt;&quot;/src/main/generated&quot;&lt;/span&gt;)).deleteDir()&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px;&quot;&gt;기존의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;generateQueryDSL&lt;/code&gt;&amp;nbsp;task를 유지할 필요 없이, java compile option으로 QClass 생성을 넣어주는것으로 script를 간략화시키는것이 가능합니다. 또한 Q class가 존재할 때, 기존 Q Class를 지워주지 않으면 compile 시에 에러를 발생하게 되기 때문에 지워주는 작업역시&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;doFirst&lt;/code&gt;에 같이 실행하고 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px;&quot;&gt;기존의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;build.gradle&lt;/code&gt;보다 간략해보여서 전 개인적으로 맘에 드네요.&lt;/p&gt;</description>
      <category>Java</category>
      <category>gradle</category>
      <category>java</category>
      <category>JPA</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/455</guid>
      <comments>https://netframework.tistory.com/entry/gradle-%EC%A0%95%EB%A6%AC-queryDSL-code-generate-v-4x#entry455comment</comments>
      <pubDate>Thu, 20 Oct 2016 08:47:35 +0900</pubDate>
    </item>
    <item>
      <title>Dependency Injection</title>
      <link>https://netframework.tistory.com/entry/Dependency-Injection</link>
      <description>&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;Dependency Injection은 angular, angular2의 핵심 기능입니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;이미 Server side 부분에서 자주 언급되고 있는 것으로, 특정 객체가 사용하는 객체군들을 만들어서 객체를 사용하는 쪽에서 골라 사용하는 개념이지요.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angularjs2&lt;/code&gt;는 자체 Dependency Injection Framework를 가지고 있습니다. 모든&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Service&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Pipe&lt;/code&gt;,&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Delegate&lt;/code&gt;는 Dependency Injection Framework를 통해 사용되어야지 됩니다.&lt;/p&gt;&lt;h1 id=&quot;root-dependency-injection-tree&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;Root Dependency Injection Tree&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angularjs2&lt;/code&gt;&amp;nbsp;applicaiton은 한개 이상의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;NgModule&lt;/code&gt;을 갖습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;bootstrap&lt;/code&gt;에 연결된 이&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;NgModule&lt;/code&gt;에서 선언된&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;providers&lt;/code&gt;&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;import&lt;/code&gt;의 경우에는 전체 Global Root Dependency Injection Tree에 등록되게 됩니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;NgModule&lt;/code&gt;에 등록된&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;providers&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;import&lt;/code&gt;는 모든&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 사용가능합니다. 각&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 한정적으로만 사용될&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Service&lt;/code&gt;나&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Pipe&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Delegate&lt;/code&gt;의 경우에는 각&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;별&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;provider&lt;/code&gt;에 등록해서 사용하면 됩니다.&lt;/p&gt;&lt;h1 id=&quot;injectable&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;@Injectable&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Injectable&lt;/code&gt;&amp;nbsp;annotation은 DI 대상을 지정합니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;service&lt;/code&gt;에서만&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Injectable&lt;/code&gt;&amp;nbsp;annotation이 사용되게 됩니다. 다른&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Component&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Pipe&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Directive&lt;/code&gt;&amp;nbsp;annotation 모두&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Injectable&lt;/code&gt;의 subset이기 때문에 따로 지정할 필요는 없습니다.&lt;/p&gt;&lt;h1 id=&quot;inject-provider&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;Inject Provider&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기본적으로 providers에는 그 객체가 지정됩니다. 다음 코드는 일반적인 providers code입니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;providers: [ Logger ]
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;이는 축약된 표현으로 원 표현은 다음과 같습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;providers: [ { provide: Logger, useClass: Logger } ]
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Logger&lt;/code&gt;라는 객체를 얻어낼려고 하면&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Logger&lt;/code&gt;를 넘겨준다는 표현식이 됩니다. 이를 좀 응용하면 다른 일들을 할 수 있습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Logger&lt;/code&gt;로 지정해두고,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;AnotherLogger&lt;/code&gt;를 inject 시킬 수 있다는 뜻이 됩니다. 다음과 같이요.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;providers: [
  AnotherLogger, 
  { provide: Logger, useClass: AnotherLogger } 
]
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;위 표현식은&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Logger&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;AnotherLogger&lt;/code&gt;&amp;nbsp;2개의 instance가 생성되게 됩니다. 모든&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Logger&lt;/code&gt;를&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;AnotherLogger&lt;/code&gt;로 바꾸어 사용하고 싶은 경우에는 다음과 같이 선언합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;providers: [
  AnotherLogger, 
  { provide: Logger, useExisting: AnotherLogger } 
]
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;지정된 객체는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;singleton instance&lt;/code&gt;로 동작하는 것이 기본값입니다. 사용될 때마다 새로운 객체를 얻어내기 위해서는&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Factory&lt;/code&gt;를 생성해야지 됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Factory&lt;/code&gt;는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;function&lt;/code&gt;&amp;nbsp;형태로 다음과 같이 선언될 수 있습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; anotherLoggerFactory = (logger: Logger) =&amp;gt; {
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;new&lt;/span&gt; AnotherLogger(logger); 
}; 
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;이렇게 선언된&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Factory&lt;/code&gt;를 다음과 같이 providers에 등록하면 이제&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;AnotherLogger&lt;/code&gt;는 사용될 때마다 신규 객체를 생성해서 처리가 되게 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;providers : [
  {
    provide: AnotherLogger,
    useFactory: anotherLoggerFactory,
    deps: [ Logger ]
  }
]
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;value-provider&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;Value Provider&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;직접적인&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;값&lt;/code&gt;을 제공하고 싶을 때 사용할 수 있습니다. applicaiton의 여러 설정들이나 상수값들을 지정할 때 사용 가능합니다. 다음과 같은 값을 전달할 때 사용할 수 있습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; appConfig = {
  apiUrl: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'http://testserver:8080/api'&lt;/span&gt;,
  userToken: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'jkfla;sjdifpqiowjerkjskadj;fla'&lt;/span&gt;
};
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;그런데, 이와 같은 값을 어떻게 하면&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;provider&lt;/code&gt;에 지정이 가능할지 의문이 듭니다. 위&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;값&lt;/code&gt;은 객체가 아닙니다. 객체가 아니기 때문에&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;DI&lt;/code&gt;에서 이용되는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Class&lt;/code&gt;가 무엇인지 알 수 없습니다. 그래서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular2&lt;/code&gt;에서는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;OpaqueToken&lt;/code&gt;이라는 것을 제공하고 있습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;OpaqueToken&lt;/code&gt;을 이용해서 다음과 같이 선언후,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Inject&lt;/code&gt;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;OpaqueToken&lt;/code&gt;을 지정해주면 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { OpaqueToken } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'@angular/core'&lt;/span&gt;;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; APP_CONFIG = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;new&lt;/span&gt; OpaqueToken(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'app.config'&lt;/span&gt;);

....

&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { APP_CONFIG } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./config'&lt;/span&gt;;

providers: [
  { provide: APP_CONFIG, useValue: appConfig }
]

....

&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;constructor&lt;/span&gt;(@Inject(APP_CONFIG) config: any) {
  &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;console&lt;/span&gt;.log(config.apiUrl);
 }
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;manual-injector&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;Manual Injector&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;직접적으로 객체를&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;DI&lt;/code&gt;&amp;nbsp;tree에서 가지고 와서 처리하고 싶을 때도 있을 수 있습니다. sping에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ApplicationContext&lt;/code&gt;에서 바로 객체를 들고오고 싶을 그럴 때와 같이요. 이러한 경우에는 다음과 같이 처리하면 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;class&lt;/span&gt; InjectorComponent {
  car: Car = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.injector.get(Car);
  heroService: HeroService = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.injector.get(HeroService);  
  hero: Hero = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.heroService.getHeroes()[&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;0&lt;/span&gt;];
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;constructor&lt;/span&gt;(private injector: Injector) { }
}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Root Provider&lt;/code&gt;에 이미&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Injector&lt;/code&gt;&amp;nbsp;서비스가 등록이 되어 있습니다. 이 등록된 서비스를 가지고 와서 사용하면 됩니다. 개인적으로는 정말 추천하지 않는 방법이긴 합니다.;&lt;/p&gt;&lt;h1 id=&quot;summary&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;SUMMARY&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2는 다양한 방법의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;DI&lt;/code&gt;를 제공하고 있습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Spring&lt;/code&gt;이나&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Castle&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Ninject&lt;/code&gt;등을 사용해보신 분들이라면 매우 익숙하겠지만, 지금까지 FrontEnd만 해본 사람들에게는 복잡한 내용임은 사실입니다. 그렇지만,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;DI&lt;/code&gt;는 angular2에서 가장 중요한 기능중 하나입니다. 객체를 어떻게 다루고, 관리할지에 대한 pattern을 결정하는 설정이니까요. 개인적으로는&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;OpaqueToken&lt;/code&gt;이 매우 인상적인것 같습니다.&lt;/p&gt;</description>
      <category>angularjs2</category>
      <category>angular2</category>
      <category>Architecture</category>
      <category>Di</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/454</guid>
      <comments>https://netframework.tistory.com/entry/Dependency-Injection#entry454comment</comments>
      <pubDate>Wed, 28 Sep 2016 15:17:07 +0900</pubDate>
    </item>
    <item>
      <title>Data Binding</title>
      <link>https://netframework.tistory.com/entry/Data-Binding</link>
      <description>&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2는 angular1과 다르게 한개의 Page가 여러개의 Component로 이루어집니다. 그리고 그 Component간의 데이터 전달은 Input/Output을 통해서 이루어집니다. 예전&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng-model&lt;/code&gt;이 이제 단방향으로 나뉘어져있다고 생각하면 쉽습니다. (ngModel과 같이 양방향 역시 존재합니다.)&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기존 angular1에서의 directive에 데이터를 넣을때를 생각해보시면 쉽습니다. directive를 하나 선언하게 되면 그에 대한 scope의 범위를 다음과 같이 선언하게 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;scope: {
  ngModel: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'='&lt;/span&gt;
}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;위와 같이 선언된&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ngModel&lt;/code&gt;은 html상에서 다음과 같이 사용되어질 수 있습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;app-directive&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;ng-model&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;models.data&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;app-directive&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2에서는 Input과 Output을 명확하게 구분합니다. 이 부분이 어찌보면 angular1과 angular2간의 가장 큰 차이라고도 볼 수 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기존 양방향 binding의 경우 performance의 문제가 발생했었고, 이는 angular1에서의 성능향상의 가장 큰 걸림돌이 되었던&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;dirty-watch&lt;/code&gt;의 문제점이기도 했습니다. 이 부분은&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;react&lt;/code&gt;에서도 적용되어 있는것으로,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;javascript&lt;/code&gt;에서의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;refrence&lt;/code&gt;type의 참조가 아닌,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;value&lt;/code&gt;로서 참조를 하게 됩니다. 이 부분은 매우 중요합니다. 결국 angular1에서의 양방향&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;reference binding&lt;/code&gt;의 문제로 binding된 model은 2개의 copy 본이 만들어지고&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;dirty-watch&lt;/code&gt;&amp;nbsp;과정을 통해 copy본과의 차이점을 알아내고 그 값을 다시 view에 binding하는 과정에서 angular1은 많은 시스템 자원을 소비하고 있었지만, angular2의 경우에는 이 과정이 없어지는거지요. binding자체가 값으로 set되는것이고, 그 set된 값은 변경되기 전에는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;rendering&lt;/code&gt;과정을 거치지 않게 됩니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;서론이 길었습니다. 이제 angular2에서의 DataBinding을 알아보도록 하겠습니다.&lt;/p&gt;&lt;h2 id=&quot;data-binding&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;Data Binding의 종류&lt;/h2&gt;&lt;ul style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;interpolation :&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;{{}}&lt;/code&gt;로 표현되는 binding입니다. 값을 화면에 표시하는 용도로 사용됩니다.&lt;/li&gt;&lt;li&gt;property binding:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;[]&lt;/code&gt;로 표현되는 binding입니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;의 property값을&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;set&lt;/code&gt;할때 사용됩니다.&lt;/li&gt;&lt;li&gt;event binding:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;()&lt;/code&gt;로 표현됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 발생되는 event를&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;get&lt;/code&gt;할때 사용됩니다.&lt;/li&gt;&lt;li&gt;two-way data binding:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;[()]&lt;/code&gt;로 표현됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 값을&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;get&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;set&lt;/code&gt;을 할 수 있습니다. 이는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ngModel&lt;/code&gt;&amp;nbsp;directive를 이용해서만 사용 가능합니다.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;먼저 간단한 2개의 Component를 통해,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;interpolation&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;property binding&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;event binding&lt;/code&gt;을 알아보도록 하겠습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { Component, OnInit } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'@angular/core'&lt;/span&gt;;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { TenantService } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'../shared/services'&lt;/span&gt;;

@Component({
  selector: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'app-feature'&lt;/span&gt;,
  templateUrl: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./feature.component.html'&lt;/span&gt;,
  styleUrls: [&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./feature.component.css'&lt;/span&gt;]
})
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;class&lt;/span&gt; FeatureComponent &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;implements&lt;/span&gt; OnInit {
  tenantList: &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;any&lt;/span&gt;[];
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;constructor&lt;/span&gt;(private tenantService: TenantService) { }
  ngOnInit() {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.tenantService.listAll().then(tenants =&amp;gt; {
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.tenantList = tenants;
    });
  }
  selectedTenant(event) {
    &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;console&lt;/span&gt;.log(event);
  }
}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { Component, OnInit, Input, Output, EventEmitter } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'@angular/core'&lt;/span&gt;;
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; * as _ from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'lodash'&lt;/span&gt;;

@Component({
  selector: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'app-tenant-list'&lt;/span&gt;,
  templateUrl: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./tenant-list.component.html'&lt;/span&gt;,
  styleUrls: [&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./tenant-list.component.css'&lt;/span&gt;]
})
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;class&lt;/span&gt; TenantListComponent &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;implements&lt;/span&gt; OnInit {
  @Input()
  tenants: &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;any&lt;/span&gt;[];
  @Output()
  select = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;new&lt;/span&gt; EventEmitter();
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;constructor&lt;/span&gt;() { }

  ngOnInit() {
  }

  selectTenant(tenantId: &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;number&lt;/span&gt;) {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; selectedTenant = _(&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.tenants).find(tenant =&amp;gt; tenant.id === tenantId);
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.select.emit(selectedTenant);
  };
}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;FeatureComponent&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;TenantListComponent&lt;/code&gt;가 있습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;FeatureComponent&lt;/code&gt;안에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;TenantListComponent&lt;/code&gt;가 Table로 구현되는 아주 간단한 구조입니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;이에 따른 html은 각각 다음과 같습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;// feature.component.html
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;app-tenant-list&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;tenants&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;tenantList&quot;&lt;/span&gt; (&lt;span class=&quot;hljs-attr&quot;&gt;select&lt;/span&gt;)=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;selectedTenant($event)&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;app-tenant-list&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;// tenant-list.component.html
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;table&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;table table-hover&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;thead&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;Id&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;Name&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;th&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;thead&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;tbody&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;tr&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngFor&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;let tenant of tenants&quot;&lt;/span&gt; (&lt;span class=&quot;hljs-attr&quot;&gt;click&lt;/span&gt;)=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;selectTenant(tenant.id)&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;{{tenant.id}}&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;{{tenant.defaultInfo.name}}&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;td&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;tr&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;tbody&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;table&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;먼저&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;feature.component.html&lt;/code&gt;에서는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;property binding&lt;/code&gt;과&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;event binding&lt;/code&gt;이 보여집니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;TenantListComponent&lt;/code&gt;에서 정의된 Property인&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;tenants&lt;/code&gt;가&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;[tenants]=&quot;tenantList&quot;&lt;/code&gt;로&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;set&lt;/code&gt;을 하고 있는 것을 보실 수 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;event binding&lt;/code&gt;의 경우에는 다양합니다. 우리가 주로 알고 있는 web에서의 click과 같은 event들이 event binding으로 처리됩니다. 이는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;tenant-list.component.html&lt;/code&gt;을 보면 확인이 가능합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;tr&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngFor&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;let tenant of tenants&quot;&lt;/span&gt; (&lt;span class=&quot;hljs-attr&quot;&gt;click&lt;/span&gt;)=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;selectTenant(tenant.id)&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;click&lt;/code&gt;&amp;nbsp;event가 발생하게 되면&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;selectTenant&lt;/code&gt;&amp;nbsp;method가 호출이 되게 됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;selectTenant&lt;/code&gt;&amp;nbsp;method는 안에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;EventEmitter&lt;/code&gt;&amp;nbsp;객체를 통해 이벤트를 발생시킵니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 외부로 노출되는 값은 모두 Event가 되게됩니다.&lt;/p&gt;&lt;h2 id=&quot;summary&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;Summary&lt;/h2&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2는 4개의 binding type을 가지고 있습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;interpolation&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;event binding&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;property binding&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;two-way binding&lt;/code&gt;이 있습니다. 4개의 용도는 다음과 같습니다.&lt;/p&gt;&lt;ul style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;interpolation&lt;/code&gt;: model의 값을 단순 display 할때 사용됩니다.&lt;/li&gt;&lt;li&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;event binding&lt;/code&gt;:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Parent Component&lt;/code&gt;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Child Component&lt;/code&gt;의 값을 가지고 올때(get) 사용됩니다. -&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Output&lt;/code&gt;과 같이 사용됩니다.&lt;/li&gt;&lt;li&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;property binding&lt;/code&gt;:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Parent Component&lt;/code&gt;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Child Component&lt;/code&gt;의 값을 설정할 때(set) 사용됩니다. -&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Input&lt;/code&gt;과 같이 사용됩니다.&lt;/li&gt;&lt;li&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;two-way binding&lt;/code&gt;:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;안에서 value와 rendering결과를 일치시킬 때, 사용됩니다. -&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;input&lt;/code&gt;&amp;nbsp;element와 같이 사용되는 경우가 많습니다.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;Binding 부분은 angular2의 가장 핵심적인 부분입니다. 직접 예시 application을 만들어서 해보는것이 좋을 것 같습니다. 그럼 Happy Coding!&lt;/p&gt;</description>
      <category>angularjs2</category>
      <category>angular-cli</category>
      <category>angular2</category>
      <category>data binding</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/453</guid>
      <comments>https://netframework.tistory.com/entry/Data-Binding#entry453comment</comments>
      <pubDate>Fri, 23 Sep 2016 00:26:35 +0900</pubDate>
    </item>
    <item>
      <title>angular cli</title>
      <link>https://netframework.tistory.com/entry/angular-cli</link>
      <description>&lt;h1 id=&quot;angular-cli&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;Angular-Cli&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;google에서 angular2와 같이 내놓은 angular2를 위한 cmd tool입니다. cmd tool중 가장 유명한 yo와 거의 동일한 기능을 제공합니다. 아직 beta version이기 때문에 발전의 여지는 많이 보이긴 하지만, angular2 application을 개발하기 위해서는 제 생각에는&amp;nbsp;&lt;strong&gt;반드시&lt;/strong&gt;&amp;nbsp;angular cli를 통해서 개발 할 필요가 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;개인적인 이유의 근거는 다음과 같습니다.&lt;/p&gt;&lt;ol style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;표준 tool로 만들었기 때문에 모든 문서는 angular cli를 기본으로 나올 가능성이 높습니다.&lt;/li&gt;&lt;li&gt;stackoverflow 와 같은 질의 응답 사이트의 내용 역시 angular cli를 기본으로 이야기하고 있습니다.&lt;/li&gt;&lt;li&gt;third party tool역시 angular cli를 기반으로 나오기 쉽습니다.&lt;/li&gt;&lt;li&gt;webpack을 기반으로 구성되어, 최적의 site를 만들기 좋습니다.&lt;/li&gt;&lt;li&gt;역으로 angular cli를 사용하지 않고, 직접 webpack 등의 설정을 하게 될 경우에 너무 힘듭니다. 진입장벽이 높아집니다.&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular cli는 기본적으로 다음 기능들을 가지고 있습니다.&lt;/p&gt;&lt;ol style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;project 초기 생성&lt;/li&gt;&lt;li&gt;component, service, pipe, directive 등의 생성&lt;/li&gt;&lt;li&gt;gulp, grunt와 같은 build tool의 제공.&lt;/li&gt;&lt;li&gt;scss, less와 같은 css preprocessor가 모두 지원&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기본적으로&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;1.0.0-beta.15&lt;/code&gt;부터 webpack과 통합되어 있기 때문에 webpack에 대한 기본 지식이 있으면 좋습니다.&lt;/p&gt;&lt;h2 id=&quot;&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;설치&lt;/h2&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;npm install -g angular-cli
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기타 tool들과 마찬가지로 npm을 이용해서 설치합니다. yo와는 다르게 다른 plugin들이 아직 제공되고 있지는 않군요.&lt;/p&gt;&lt;h2 id=&quot;project&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;project 초기 생성&lt;/h2&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;ng new {{Project이름}}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;위 command를 이용하면 Project이름으로 새로운 folder가 하나 생성되고, 기본적인 application 이 구성됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;cd {{Project이름}}
ng serve
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;를 실행하면 기본적인 angular2 application이 만들어집니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;├── angular-cli.json
├── e2e
│&amp;nbsp;&amp;nbsp; ├── app.e2e-spec.ts
│&amp;nbsp;&amp;nbsp; ├── app.po.ts
│&amp;nbsp;&amp;nbsp; └── tsconfig.json
├── karma.conf.js
├── node_modules
├── package.json
├── protractor.conf.js
├── README.md
├── src
│&amp;nbsp;&amp;nbsp; ├── app
│&amp;nbsp;&amp;nbsp; ├── assets
│&amp;nbsp;&amp;nbsp; ├── environments
│&amp;nbsp;&amp;nbsp; ├── favicon.ico
│&amp;nbsp;&amp;nbsp; ├── index.html
│&amp;nbsp;&amp;nbsp; ├── main.ts
│&amp;nbsp;&amp;nbsp; ├── polyfills.ts
│&amp;nbsp;&amp;nbsp; ├── styles.css
│&amp;nbsp;&amp;nbsp; ├── test.ts
│&amp;nbsp;&amp;nbsp; ├── tsconfig.json
│&amp;nbsp;&amp;nbsp; └── typings.d.ts
└── tslint.json
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;folder는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;e2e&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;src&lt;/code&gt;가 만들어지는데,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;e2e&lt;/code&gt;는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;end to end&lt;/code&gt;&amp;nbsp;test code가 위치하는 곳이고 개발은 주로&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;src&lt;/code&gt;에서 이루어지게 됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;yo&lt;/code&gt;에서는 이렇게 생성된 json 파일들을 조금 뜯어볼 필요성이 있는데,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular cli&lt;/code&gt;의 경우에는 거의 그럴 필요성이 느껴지지 않습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;e2e&lt;/code&gt;&amp;nbsp;테스트를 위한&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;protractor.conf.js&lt;/code&gt;파일을 제외하면, 사용자가 건드릴 만한 파일들은 없습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;src&lt;/code&gt;에 만들어진 file 구성을 보면 component, spec, css, html 이 모두 갖추어져 있는것을 볼 수 있습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular-cli&lt;/code&gt;는 개발자에게 component와 그에 따른 view file 들, 즉 css와 html이 같이 있는 구조를 강제합니다. 대부분의 angular2 tutorial에서 그리했듯이요. 기본적으로 만들어진 file의 내용은 다음과 같습니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { Component, OnInit } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'@angular/core'&lt;/span&gt;;

@Component({
  selector: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'app-info'&lt;/span&gt;,
  templateUrl: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./info.component.html'&lt;/span&gt;,
  styleUrls: [&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'./info.component.css'&lt;/span&gt;]
})
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;class&lt;/span&gt; InfoComponent &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;implements&lt;/span&gt; OnInit {

  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;constructor&lt;/span&gt;() { }

  ngOnInit() {
  }

}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;매우 간단하지만, 타이핑이 귀찮은 것들은 많이 들어가 있는것을 볼 수 있습니다.&lt;/p&gt;&lt;h2 id=&quot;component-service-pipe-directive&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;component, service, pipe, directive 생성&lt;/h2&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;ng g {{type}} {{name}}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;을 통해, 각각의 항목들을 만들어낼 수 있습니다. 여기서 재미있는것은 만약에&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g component home.component&lt;/code&gt;를 통해 생성을 하면&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;/src/home&lt;/code&gt;&amp;nbsp;folder가 기본으로 생깁니다. 이는 root folder에 너무 많은 파일들을 놓지 않으려는 배려로 볼 수 있겠네요. cmd를 통해서 생성하는 것들은 다음과 같습니다.&lt;/p&gt;&lt;table style=&quot;border-collapse: collapse; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;thead&gt;&lt;tr&gt;&lt;th style=&quot;text-align: left; border-bottom-width: 1px; border-bottom-style: solid; border-color: rgba(0, 0, 0, 0.690196); padding: 5px 10px;&quot;&gt;Scaffold&lt;/th&gt;&lt;th style=&quot;text-align: left; border-bottom-width: 1px; border-bottom-style: solid; border-color: rgba(0, 0, 0, 0.690196); padding: 5px 10px;&quot;&gt;Usage&lt;/th&gt;&lt;/tr&gt;&lt;/thead&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px;&quot;&gt;Component&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g component my-new-component&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;Directive&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g directive my-new-directive&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;Pipe&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g pipe my-new-pipe&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;Service&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g service my-new-service&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;Class&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g class my-new-class&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;Interface&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g interface my-new-interface&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;Enum&lt;/td&gt;&lt;td style=&quot;padding: 5px 10px; border-top-width: 1px; border-top-style: solid; border-color: rgba(0, 0, 0, 0.180392);&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, 'Droid Sans Mono', 'Courier New', monospace, 'Droid Sans Fallback'; font-size: 14px; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng g enum my-new-enum&lt;/code&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;생성된 Component들은 모두&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;app.module.ts&lt;/code&gt;의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;declarations&lt;/code&gt;에 기본적으로 추가되어 있습니다. 타 객체들은 추가되어있지 않으니, 상황에 따라 Component에 추가하는 것이 필요합니다.&lt;/p&gt;&lt;h2 id=&quot;route&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;route 지원&lt;/h2&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;안타깝게도&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular-cli&lt;/code&gt;는 route를 생성하는 것을 지원하지 않습니다. 개발 방향을 잡고 있다니, 추후를 기대해봐도 좋을것 같습니다.&lt;/p&gt;&lt;h2 id=&quot;&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;실행&lt;/h2&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;ng serve
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;명령어로 실행이 가능합니다. 기본적으로 4200 port를 이용해서 처리되며, 파일 변경시 webpack watch를 통해 다시 build가 됩니다.&lt;/p&gt;&lt;h2 id=&quot;proxy&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;Proxy 설정&lt;/h2&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;web application을 개발하게 되면 필연적으로 필요하게 되는 것이 Proxy입니다. 내부내에서 타 URL로 proxy를 통해 API를 호출하기 위해서는 내부 Proxy설정이 필요합니다. 이를 angular cli에서는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;--proxy-config&lt;/code&gt;를 통해 해결하고 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;먼저, 기본적으로 angular cli에서 사용되는것은 webpack입니다. webpack dev server 설정에서의 proxy설정 방법과 완전 동일합니다. 그런데, webpack의 경우에는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;webpack.config.js&lt;/code&gt;파일이 존재합니다. 그럼 angular cli는? 폴더의 어느곳을 뒤져봐도 위 파일은 존재하지 않습니다. angular cli는 webpack을 철저하게 wrapping해서 보여주기 때문이지요.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;proxy를 구성하기 위해서는 추가 파일을 생성해서 처리해야지 됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;proxy.json&lt;/code&gt;파일을 따로 생성해서 처리하면 됩니다. 다음은 제&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;proxy.json&lt;/code&gt;파일입니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&quot;/fms-api/v2&quot;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;2개의 proxy를 구성하였고, 구성된&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;proxy.json&lt;/code&gt;을 통해 실행시키기 위해서는 다음 cmd를 사용하면 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;ng serve --proxy-config proxy.json
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;이렇게 하면 실행창에 다음과 같은 구문이 나타납니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;ykyoon@ykyoon ~/dev/code/cli-test1/my-dream-app $ ng serve --proxy-config proxy.json
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
** NG Live Development Server is running on http://localhost:4200. **
 10% building modules 2/2 modules 0 active[HPM] Proxy created: /fms-api/v2  -&amp;gt;  http://localhost:8000
[HPM] Proxy rewrite rule created: &quot;/fms-api/v2&quot; ~&amp;gt; &quot;&quot;
[HPM] Proxy created: /socket.io  -&amp;gt;  http://localhost:5000
4265ms building modules                                                                  
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;Proxy에 설정에 대한 문서는&amp;nbsp;&lt;a href=&quot;https://webpack.github.io/docs/webpack-dev-server.html&quot; style=&quot;color: rgb(64, 128, 208);&quot;&gt;webpack dev server 설정&lt;/a&gt;과 동일합니다.&lt;/p&gt;&lt;h2 id=&quot;3rd-party-library&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;3rd party library&lt;/h2&gt;&lt;h3 id=&quot;lodash&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;lodash&lt;/h3&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;개인적으로는 jquery보다 더 필요한것이 이젠 lodash입니다. lodash 추가는 일반적으로 우리가 알고 있는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;npm install lodash --save&lt;/code&gt;로 하는 것이 아니라 다음 command를 이용해서 해줘야지 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;npm install @types/lodash --save
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;그리고&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;lodash&lt;/code&gt;를 사용하고자 하는 곳에서 다음과 같이 사용합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; * as _ from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'lodash'&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;jquery-bootstrap&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;jquery &amp;amp; bootstrap&lt;/h3&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;jquery의 경우에는 조금 다릅니다. jquery의 경우에는 근간에는 거의 모든 외부 library들이 먼저 jquery가 추가된 후에 동작되는 것이 일반적인데, webpack에서 주로 사용하는 방식으로&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;import&lt;/code&gt;를 이용하면 이를 반영할수가 없습니다. 이렇게 먼저 추가되어야지 되는 library들이 있는 경우,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular-cli.json&lt;/code&gt;파일을 수정할 필요가 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;먼저&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;npm&lt;/code&gt;을 이용해서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;jquery&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;bootstrap&lt;/code&gt;을 추가합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;npm install jquery --save
npm install bootstrap@next --save //bootstrap version 4
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;다음,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;script&lt;/code&gt;항목으로 들어가 추가되어야지 될&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;js&lt;/code&gt;파일을&amp;nbsp;&lt;strong&gt;순서대로&lt;/strong&gt;&amp;nbsp;넣어줍니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;      &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;scripts&quot;&lt;/span&gt;: [
        &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;../node_modules/jquery/dist/jquery.js&quot;&lt;/span&gt;,
        &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;../node_modules/tether/dist/js/tether.js&quot;&lt;/span&gt;,
        &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;../node_modules/bootstrap/dist/js/bootstrap.js&quot;&lt;/span&gt;
      ],
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;마지막으로&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;styles&lt;/code&gt;에 bootstrap을 추가하면 완료됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;      &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;styles&quot;&lt;/span&gt;: [
        &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;styles.css&quot;&lt;/span&gt;,
        &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;../node_modules/bootstrap/dist/css/bootstrap.css&quot;&lt;/span&gt;
      ],
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h1 id=&quot;summary&quot; style=&quot;padding-bottom: 0.3em; line-height: 1.2; border-bottom: 1px solid rgba(0, 0, 0, 0.180392); font-weight: normal; border-top-color: rgba(0, 0, 0, 0.180392); border-right-color: rgba(0, 0, 0, 0.180392); border-left-color: rgba(0, 0, 0, 0.180392); color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; widows: 1;&quot;&gt;Summary&lt;/h1&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular-cli&lt;/code&gt;는 매우 강력한 tool입니다. 또한 angular2 개발 방법의 표준을 제공하고 있습니다. 이는 강력하지는 않지만, 많은 3rd party library와 사용자들에게 영향을 주게 될 것입니다. 다른 3rd party library들의 사용방법이&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular-cli&lt;/code&gt;를 기준으로 문서가 만들어질 가능성이 매우 높습니다.&lt;/p&gt;</description>
      <category>angularjs2</category>
      <category>angular-cli</category>
      <category>angular2</category>
      <category>Tools</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/452</guid>
      <comments>https://netframework.tistory.com/entry/angular-cli#entry452comment</comments>
      <pubDate>Wed, 21 Sep 2016 09:37:52 +0900</pubDate>
    </item>
    <item>
      <title>angular2 animation</title>
      <link>https://netframework.tistory.com/entry/angular2-animation</link>
      <description>&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2에서의 animation은&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;state의 변경&lt;/code&gt;으로 제어가 가능합니다. 기존의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;css&lt;/code&gt;를 지정해주었던 것에서 많은 변화가 생긴것이지요.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;animation을 사용하기 위해서는 다음 모듈들을 import시켜야지 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; {
  Component,
  Input,
  trigger,
  state,
  style,
  transition,
  animate
} from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'@angular/core'&lt;/span&gt;;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;후에&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;@Component&lt;/code&gt;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;animations&lt;/code&gt;를 다음과 같이 정의합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;  animations: [
    trigger(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'showDetailed'&lt;/span&gt;, [
      state(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'summary'&lt;/span&gt;, style({ height: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'0px'&lt;/span&gt;, display: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'none'&lt;/span&gt; })),
      state(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'detailed'&lt;/span&gt;, style({ height: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'250px'&lt;/span&gt;, display: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'inherit'&lt;/span&gt; })),
      transition(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'summary &amp;lt;=&amp;gt; detailed'&lt;/span&gt;, animate(&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;250&lt;/span&gt;)),
    ])
  ]
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;각 항목은 다음과 같습니다.&lt;/p&gt;&lt;ul style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;trigger(name): state 이름을 정합니다.&lt;/li&gt;&lt;li&gt;state(stateName): state의 상태이름을 지정하고, 상태이름일때의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;style&lt;/code&gt;&amp;nbsp;를 지정합니다.&lt;/li&gt;&lt;li&gt;transaction: state 상태의 변경시에 동작할 animation을 지정합니다. 상태는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;=&amp;gt;&lt;/code&gt;,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&amp;lt;=&amp;gt;&lt;/code&gt;&amp;nbsp;을 지정합니다.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2에서의 animation은 상태의 변화시에 동작 이라고 정의하면 이해하기 쉽습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;간단히&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;showDetailed&lt;/code&gt;&amp;nbsp;trigger의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;summary&lt;/code&gt;와&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;detailed&lt;/code&gt;&amp;nbsp;상태의 변화에 있어서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;summary&lt;/code&gt;일때의 최종 style과&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;detailed&lt;/code&gt;상태일때의 최종 style을 지정해주고, state의 변경시에 발생되는 animation의 시간과 style을 정해주는 것으로 animation 효과를 넣을 수 있습니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;주로 사용될&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;style&lt;/code&gt;들은 다음과 같습니다.&lt;/p&gt;&lt;ul style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;mouse-over:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;{transform: translateX(0) scale(1.1)}&lt;/code&gt;&lt;/li&gt;&lt;li&gt;mouse-leave:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;{transform: translateX(0) scale(1)}&lt;/code&gt;&lt;/li&gt;&lt;li&gt;show:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;{ height: '200px', display: 'inherit' }&lt;/code&gt;&lt;/li&gt;&lt;li&gt;hide:&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;{ height: '0px', display: 'none' }&lt;/code&gt;&lt;/li&gt;&lt;/ul&gt;&lt;h2 id=&quot;summary&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;summary&lt;/h2&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2에서는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;state&lt;/code&gt;라는 개념을 이용해서 animation을 넣어줍니다. 이는 객체의 상태 변화와 View에서의 animation을 적절히 조화시킬 수 있는 멋진 방법입니다. 그런데 이를 이용하기 위해서는 결국은 view component를 어떻게 잘 나누어서 설계하느냐에 대한 설계상의 이슈가 발생됩니다. 예전 개발 패턴대로 html 하나에 모두 때려 넣는것이 아닌, 하나하나의 Component로 Page 자체를 설계하는 View단에서의 객체지향적 개발 패턴이 필요합니다. 재미있어요.&lt;/p&gt;</description>
      <category>angularjs2</category>
      <category>angular2</category>
      <category>animation</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/451</guid>
      <comments>https://netframework.tistory.com/entry/angular2-animation#entry451comment</comments>
      <pubDate>Tue, 13 Sep 2016 16:45:19 +0900</pubDate>
    </item>
    <item>
      <title>angular2 form</title>
      <link>https://netframework.tistory.com/entry/angular2-form</link>
      <description>&lt;h2 id=&quot;angular2-form&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;angular2 form&lt;/h2&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기존 angularjs에서 문제가 되었던&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;form&lt;/code&gt;이 크게 향상되었습니다. 기존 form의 문제점은 다음과 같습니다.&lt;/p&gt;&lt;ol style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;li&gt;form의 생성시기를 알 수 없습니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;div&lt;/code&gt;&amp;nbsp;tag를 통해서 생성되는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng-form&lt;/code&gt;은 생성시기를 알 수 없기 때문에,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;form&lt;/code&gt;을 검사하기 위해서는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;null&lt;/code&gt;&amp;nbsp;error를 꼭 check하는 것이 좋습니다.&lt;/li&gt;&lt;li&gt;form error text가 html에 담긴다. form에서 발생되는 error를 표시하는 방법이 모두 html에 기술되어야지 됩니다. 이에 대한 구현의 문제는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;html&lt;/code&gt;이 과도하게 길어지는 문제가 발생하게 되고,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ng-if&lt;/code&gt;의 남발이 발생하게 됩니다.&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;angular2&lt;/code&gt;는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;NgForm&lt;/code&gt;의 제어 영역을&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;component&lt;/code&gt;로 이동시켜서 기존의&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;html&lt;/code&gt;에서 제어되는 것이 아닌&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;component&lt;/code&gt;에서 제어되는 것으로 구현을 변경하였습니다. 물론, 기존과 같은 패턴 역시 사용가능합니다.&lt;/p&gt;&lt;h3 id=&quot;form-validation-old-pattern&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;Form Validation - Old Pattern&lt;/h3&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;기존&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ngForm&lt;/code&gt;을 이용하는 방법과 거의 유사합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;form&lt;/span&gt; #&lt;span class=&quot;hljs-attr&quot;&gt;heroForm&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;ngForm&quot;&lt;/span&gt; (&lt;span class=&quot;hljs-attr&quot;&gt;ngSubmit&lt;/span&gt;)=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;onSubmit()&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-group&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;for&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;Name&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name&quot;&lt;/span&gt; [(&lt;span class=&quot;hljs-attr&quot;&gt;ngModel&lt;/span&gt;)]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;hero.name&quot;&lt;/span&gt; #&lt;span class=&quot;hljs-attr&quot;&gt;name&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;ngModel&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-control&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;required&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;minlength&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;4&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;maxlength&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;24&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngIf&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name.errors &amp;amp;&amp;amp; (name.dirty || name.touched)&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alert alert-danger&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;hidden&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;!name.errors.required&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
        Name is required
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;hidden&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;!name.errors.minlength&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
        Name must be at least 4 characters long.
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;hidden&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;!name.errors.maxlength&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
        Name cannot be more than 24 characters long.
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;export&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;class&lt;/span&gt; HeroFormTemplate1Component {
  powers = [&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'Really Smart'&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'Super Flexible'&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'Weather Changer'&lt;/span&gt;];
  hero = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;new&lt;/span&gt; Hero(&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;18&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'Dr. WhatIsHisWayTooLongName'&lt;/span&gt;, &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.powers[&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;0&lt;/span&gt;], &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'Dr. What'&lt;/span&gt;);
  submitted = &lt;span class=&quot;hljs-literal&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;false&lt;/span&gt;;
  active = &lt;span class=&quot;hljs-literal&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;true&lt;/span&gt;;

  onSubmit() {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.submitted = &lt;span class=&quot;hljs-literal&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;true&lt;/span&gt;;
  }
  addHero() {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.hero = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;new&lt;/span&gt; Hero(&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;42&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;''&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;''&lt;/span&gt;);
  }
}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;각&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;form&lt;/code&gt;의 이름을 이용하고&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;[(ngModel)]&lt;/code&gt;을 이용해서 model과 값을 binding시켜 사용합니다. 여기서 주의할 점은&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;#name&lt;/code&gt;입니다. 이는 꼭&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ngModel&lt;/code&gt;을 적어줘야지 되며,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ngModel&lt;/code&gt;을 이용해서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;heroForm&lt;/code&gt;과 binding이 되게 됩니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;이 code의 최고 문제는 html에 error message가 그대로 노출된다는 점입니다. 이를 해결해주기 위해서는 다음과 같이 구성합니다.&lt;/p&gt;&lt;h3 id=&quot;form-validation-new-pattern&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;Form Validation - new Pattern&lt;/h3&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;새로운 패턴에서 확인할 점은&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;NgForm&lt;/code&gt;의 생성과 Error Message의 관리 포인트가&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;로 넘어왔다는 점입니다. 먼저&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;FormBuilder&lt;/code&gt;를 Import합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;import&lt;/span&gt; { FormGroup, FormBuilder, Validators } from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'@angular/forms'&lt;/span&gt;;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;그리고,&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ngOnInit&lt;/code&gt;에서&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;FormGroup&lt;/code&gt;을 생성시켜줍니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;constructor&lt;/span&gt;(private fb: FormBuilder) { }
ngOnInit(): &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;void&lt;/span&gt; {
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.buildForm();
}
buildForm(): &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;void&lt;/span&gt; {
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.heroForm = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.fb.group({
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'name'&lt;/span&gt;: [&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.hero.name, [
        Validators.required,
        Validators.minLength(&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;4&lt;/span&gt;),
        Validators.maxLength(&lt;span class=&quot;hljs-number&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;24&lt;/span&gt;),
      ]
    ],
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'alterEgo'&lt;/span&gt;: [&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.hero.alterEgo, [ Validators.required ]],
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;'power'&lt;/span&gt;: [&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.hero.power, Validators.required]
  });
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.heroForm.valueChanges
    .subscribe(data =&amp;gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.onValueChanged(data));
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.onValueChanged(); &lt;span class=&quot;hljs-comment&quot; style=&quot;color: rgb(142, 144, 140);&quot;&gt;// (re)set validation messages now&lt;/span&gt;
}
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;FormBuilder.group&lt;/code&gt;은 각 Form element name에 따른&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Validators&lt;/code&gt;를 갖습니다. Form Validation 조건들을 각&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 처리가 가능해지는 것입니다. 또한 각 error에 대한 message 처리 역시&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 가능하게 됩니다. 이는 위 코드 중&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;onValueChanged&lt;/code&gt;에서 처리 가능합니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;onValueChanged(data?: &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(245, 135, 31);&quot;&gt;any&lt;/span&gt;) {
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;if&lt;/span&gt; (!&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.heroForm) { &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;return&lt;/span&gt;; }
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; form = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.heroForm;
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; field &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.formErrors) {
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.formErrors[field] = &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;&quot;&lt;/span&gt;;
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; control = form.get(field);
    &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;if&lt;/span&gt; (control &amp;amp;&amp;amp; control.dirty &amp;amp;&amp;amp; !control.valid) {
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; messages = &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.validationMessages[field];
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;const&lt;/span&gt; key &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;in&lt;/span&gt; control.errors) {
        &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(137, 89, 168);&quot;&gt;this&lt;/span&gt;.formErrors[field] += messages[key] + &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot; &quot;&lt;/span&gt;;
      }
    }
  }
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;form&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;formGroup&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;heroForm&quot;&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngIf&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;active&quot;&lt;/span&gt; (&lt;span class=&quot;hljs-attr&quot;&gt;ngSubmit&lt;/span&gt;)=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;onSubmit()&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-group&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;for&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;Name&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-control&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;formControlName&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;name&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;required&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngIf&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;formErrors.name&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alert alert-danger&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
      {{ formErrors.name }}
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-group&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;for&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alterEgo&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;Alter Ego&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;input&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;text&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alterEgo&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-control&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;formControlName&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alterEgo&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;required&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngIf&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;formErrors.alterEgo&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alert alert-danger&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
      {{ formErrors.alterEgo }}
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-group&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;for&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;power&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;Hero Power&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;label&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;select&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;id&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;power&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;form-control&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;formControlName&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;power&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;required&lt;/span&gt;&amp;gt;&lt;/span&gt;
      &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;option&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngFor&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;let p of powers&quot;&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;value&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;p&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;{{p}}&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;option&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;select&lt;/span&gt;&amp;gt;&lt;/span&gt;
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt; *&lt;span class=&quot;hljs-attr&quot;&gt;ngIf&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;formErrors.power&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;alert alert-danger&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;
      {{ formErrors.power }}
    &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;div&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;button&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;submit&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;btn btn-default&quot;&lt;/span&gt; [&lt;span class=&quot;hljs-attr&quot;&gt;disabled&lt;/span&gt;]=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;!heroForm.valid&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/span&gt;
  &lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;&lt;span class=&quot;hljs-name&quot;&gt;button&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;type&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;button&quot;&lt;/span&gt; &lt;span class=&quot;hljs-attr&quot;&gt;class&lt;/span&gt;=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;btn btn-default&quot;&lt;/span&gt; (&lt;span class=&quot;hljs-attr&quot;&gt;click&lt;/span&gt;)=&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(113, 140, 0);&quot;&gt;&quot;addHero()&quot;&lt;/span&gt;&amp;gt;&lt;/span&gt;New Hero&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;button&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;span class=&quot;hljs-tag&quot; style=&quot;color: rgb(200, 40, 41);&quot;&gt;&amp;lt;/&lt;span class=&quot;hljs-name&quot;&gt;form&lt;/span&gt;&amp;gt;&lt;/span&gt;
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;customevalidation&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;CustomeValidation 처리&lt;/h3&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;CustomValidation의 경우에는 특수한 함수 형태를 반환해야지 됩니다.&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;ValidatorFn&lt;/code&gt;을 반환하는 함수를 작성하고, 그 함수를&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;FormGroup.group&lt;/code&gt;&amp;nbsp;함수에 Binding시켜주면 됩니다.&lt;/p&gt;&lt;pre class=&quot;hljs&quot; style=&quot;overflow-x: auto; color: rgb(77, 77, 76); padding: 0.5em; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;&lt;div style=&quot;padding: 16px; border-radius: 3px; overflow: auto; background-color: rgba(220, 220, 220, 0.4);&quot;&gt;import { ValidatorFn } from '@angular/forms';

forbiddenNameValidator(nameRe: RegExp): ValidatorFn {
  return (control: AbstractControl): { [key: string]: any } =&amp;gt; {
    const name = control.value;
    const no = nameRe.test(name);
    return no ? { 'forbiddenName': { name } } : null;
  };
}

this.heroForm = this.fb.group({
  'name': [this.hero.name, [
      Validators.required,
      Validators.minLength(4),
      Validators.maxLength(24),
      this.forbiddenNameValidator(/bob/i)
    ]
  ],
  'alterEgo': [this.hero.alterEgo, [ Validators.required ]],
  'power': [this.hero.power, Validators.required]
});
&lt;/div&gt;&lt;/code&gt;&lt;/pre&gt;&lt;h3 id=&quot;summary&quot; style=&quot;font-weight: normal; color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 22px; widows: 1;&quot;&gt;Summary&lt;/h3&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;angular2에서의 FormValidation은 많은 발전을 가지고 왔습니다. 가장 큰 변화는&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;Component&lt;/code&gt;에서 Error Message 및 조건들을 관리하기 편해졌다는 것입니다. 기존&amp;nbsp;&lt;code style=&quot;font-family: Menlo, Monaco, Consolas, &amp;quot;Droid Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, &amp;quot;Droid Sans Fallback&amp;quot;; line-height: 19px; color: rgb(163, 21, 21);&quot;&gt;html&lt;/code&gt;에서 처리하는 방법 역시 가지고 있지만, 개인적으로는 최대한 사용하지 않는것이 좋아보입니다.&lt;/p&gt;&lt;p style=&quot;color: rgb(30, 30, 30); font-family: &amp;quot;Segoe WPC&amp;quot;, &amp;quot;Segoe UI&amp;quot;, SFUIText-Light, HelveticaNeue-Light, sans-serif, &amp;quot;Droid Sans Fallback&amp;quot;; font-size: 14px; line-height: 22px; widows: 1;&quot;&gt;또한, 다국어 처리에 있어서도 더 나은 방법이 될 수 있습니다.&lt;/p&gt;</description>
      <category>angularjs2</category>
      <category>angularjs2</category>
      <category>JavaScript</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/450</guid>
      <comments>https://netframework.tistory.com/entry/angular2-form#entry450comment</comments>
      <pubDate>Tue, 13 Sep 2016 14:03:19 +0900</pubDate>
    </item>
    <item>
      <title>angular2 + webpack 개발</title>
      <link>https://netframework.tistory.com/entry/angular2-webpack-%EA%B0%9C%EB%B0%9C</link>
      <description>&lt;div style=&quot;font-family: 'Lucida Grande', 'Segoe UI', 'Apple SD Gothic Neo', 'Malgun Gothic', 'Lucida Sans Unicode', Helvetica, Arial, sans-serif; font-size: 0.9em; overflow-x: hidden; overflow-y: auto; margin: 0px !important; padding: 5px 20px 26px !important; background-color: rgb(255, 255, 255);font-family: 'Hiragino Sans GB', 'Microsoft YaHei', STHeiti, SimSun, 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', 'Segoe UI', AppleSDGothicNeo-Medium, 'Malgun Gothic', Verdana, Tahoma, sans-serif; padding: 20px;padding: 20px; font-family: 'Helvetica Neue', Helvetica, 'Hiragino Sans GB', 'Microsoft YaHei', STHeiti, SimSun, 'Segoe UI', AppleSDGothicNeo-Medium, 'Malgun Gothic', Arial, freesans, sans-serif; font-size: 15px; line-height: 1.6; -webkit-font-smoothing: antialiased; background: rgb(255, 255, 255);&quot;&gt;&lt;h1 id=&quot;angular2-+-webpack&quot; style=&quot;clear: both;font-size: 2.2em; font-weight: bold; margin: 1.5em 0px 1em;margin-top: 0px;&quot;&gt;&lt;a name=&quot;angular2-+-webpack&quot; href=&quot;#angular2-+-webpack&quot; style=&quot;text-decoration: none; vertical-align: baseline;color: rgb(50, 105, 160);&quot;&gt;&lt;/a&gt;Angular2 + webpack&lt;/h1&gt;&lt;h2 id=&quot;기본-npm-package-준비&quot; style=&quot;clear: both;font-size: 1.8em; font-weight: bold; margin: 1.275em 0px 0.85em;border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(230, 230, 230); line-height: 1.6;&quot;&gt;&lt;a name=&quot;기본-npm-package-준비&quot; href=&quot;#기본-npm-package-준비&quot; style=&quot;text-decoration: none; vertical-align: baseline;color: rgb(50, 105, 160);&quot;&gt;&lt;/a&gt;기본 npm package 준비&lt;/h2&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;display: block; overflow-x: auto; padding: 0.5em; color: rgb(101, 123, 131); background: rgb(253, 246, 227);&quot;&gt;&lt;code class=&quot;json&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;json&amp;quot;&gt;{
  &amp;quot;name&amp;quot;: &amp;quot;angular2-test&amp;quot;,
  &amp;quot;version&amp;quot;: &amp;quot;1.0.0&amp;quot;,
  &amp;quot;description&amp;quot;: &amp;quot;&amp;quot;,
  &amp;quot;main&amp;quot;: &amp;quot;index.js&amp;quot;,
  &amp;quot;scripts&amp;quot;: {
    &amp;quot;test&amp;quot;: &amp;quot;echo \&amp;quot;Error: no test specified\&amp;quot; &amp;amp;amp;&amp;amp;amp; exit 1&amp;quot;
  },
  &amp;quot;author&amp;quot;: &amp;quot;&amp;quot;,
  &amp;quot;license&amp;quot;: &amp;quot;ISC&amp;quot;,
  &amp;quot;dependencies&amp;quot;: {
    &amp;quot;angular2&amp;quot;: &amp;quot;^2.0.0-beta.15&amp;quot;,
    &amp;quot;bluebird&amp;quot;: &amp;quot;^3.3.5&amp;quot;,
    &amp;quot;core-js&amp;quot;: &amp;quot;^2.2.2&amp;quot;,
    &amp;quot;lodash&amp;quot;: &amp;quot;^4.11.1&amp;quot;,
    &amp;quot;reflect-metadata&amp;quot;: &amp;quot;^0.1.3&amp;quot;,
    &amp;quot;rxjs&amp;quot;: &amp;quot;^5.0.0-beta.6&amp;quot;,
    &amp;quot;zone.js&amp;quot;: &amp;quot;^0.6.11&amp;quot;
  },
  &amp;quot;devDependencies&amp;quot;: {
    &amp;quot;awesome-typescript-loader&amp;quot;: &amp;quot;^0.17.0-rc.6&amp;quot;,
    &amp;quot;copy-webpack-plugin&amp;quot;: &amp;quot;^2.1.1&amp;quot;,
    &amp;quot;html-webpack-plugin&amp;quot;: &amp;quot;^2.15.0&amp;quot;
  }
}
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;{
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;name&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;angular2-test&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;version&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;1.0.0&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;description&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;main&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;index.js&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;scripts&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;{
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;test&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;echo \&quot;Error: no test specified\&quot; &amp;amp;&amp;amp; exit 1&quot;&lt;/span&gt;
  &lt;/span&gt;}&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;author&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;license&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;ISC&quot;&lt;/span&gt;&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;dependencies&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;{
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;angular2&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^2.0.0-beta.15&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;bluebird&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^3.3.5&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;core-js&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^2.2.2&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;lodash&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^4.11.1&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;reflect-metadata&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^0.1.3&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;rxjs&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^5.0.0-beta.6&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;zone.js&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^0.6.11&quot;&lt;/span&gt;
  &lt;/span&gt;}&lt;/span&gt;,
  &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;devDependencies&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;{
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;awesome-typescript-loader&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^0.17.0-rc.6&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;copy-webpack-plugin&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^2.1.1&quot;&lt;/span&gt;&lt;/span&gt;,
    &quot;&lt;span class=&quot;hljs-attribute&quot; style=&quot;color: rgb(181, 137, 0);&quot;&gt;html-webpack-plugin&lt;/span&gt;&quot;: &lt;span class=&quot;hljs-value&quot;&gt;&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;^2.15.0&quot;&lt;/span&gt;
  &lt;/span&gt;}
&lt;/span&gt;}
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin: 1em 0px; word-wrap: break-word;&quot;&gt;기본적으로 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;reflect-metadata&lt;/code&gt;, &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;rxjs&lt;/code&gt;, &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;zone.js&lt;/code&gt;는 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;angular2&lt;/code&gt;와 같이 설치되어야지 된다. &lt;/p&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;&quot;&gt;&lt;code class=&quot;cmd&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;cmd&amp;quot;&gt;npm install rxjs --save
npm install reflect-metadata --save
npm install zone.js --save
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;npm install rxjs --save
npm install reflect-metadata --save
npm install zone.js --save
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;typescript-설정&quot; style=&quot;clear: both;font-size: 1.8em; font-weight: bold; margin: 1.275em 0px 0.85em;border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(230, 230, 230); line-height: 1.6;&quot;&gt;&lt;a name=&quot;typescript-설정&quot; href=&quot;#typescript-설정&quot; style=&quot;text-decoration: none; vertical-align: baseline;color: rgb(50, 105, 160);&quot;&gt;&lt;/a&gt;typescript 설정&lt;/h2&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;&quot;&gt;&lt;code data-origin=&quot;&lt;pre&gt;&lt;code&gt;npm install typings --global
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;npm install typings --global
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li style=&quot;display: list-item; line-height: 1.4em;&quot;&gt;&lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;tsd&lt;/code&gt;는 deprecated되었기 때문에 더이상 사용되지 않는다.&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin: 1em 0px; word-wrap: break-word;&quot;&gt;tsconfig.json&lt;/p&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;display: block; overflow-x: auto; padding: 0.5em; color: rgb(101, 123, 131); background: rgb(253, 246, 227);&quot;&gt;&lt;code class=&quot;js&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;js&amp;quot;&gt;{
  &amp;quot;compilerOptions&amp;quot;: {
    &amp;quot;target&amp;quot;: &amp;quot;es5&amp;quot;,
    &amp;quot;module&amp;quot;: &amp;quot;commonjs&amp;quot;,
    &amp;quot;emitDecoratorMetadata&amp;quot;: true,
    &amp;quot;experimentalDecorators&amp;quot;: true,
    &amp;quot;sourceMap&amp;quot;: true
  },
  &amp;quot;exclude&amp;quot;: [
    &amp;quot;node_modules&amp;quot;,
    &amp;quot;typings/main&amp;quot;,
    &amp;quot;typings/main.d.ts&amp;quot;,
    &amp;quot;bower_components&amp;quot;
  ]
}
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;{
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;compilerOptions&quot;&lt;/span&gt;: {
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;target&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;es5&quot;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;module&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;commonjs&quot;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;emitDecoratorMetadata&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;experimentalDecorators&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;sourceMap&quot;&lt;/span&gt;: &lt;span class=&quot;hljs-literal&quot;&gt;true&lt;/span&gt;
  },
  &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;exclude&quot;&lt;/span&gt;: [
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;node_modules&quot;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;typings/main&quot;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;typings/main.d.ts&quot;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;&quot;bower_components&quot;&lt;/span&gt;
  ]
}
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;webpack-설정&quot; style=&quot;clear: both;font-size: 1.8em; font-weight: bold; margin: 1.275em 0px 0.85em;border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(230, 230, 230); line-height: 1.6;&quot;&gt;&lt;a name=&quot;webpack-설정&quot; href=&quot;#webpack-설정&quot; style=&quot;text-decoration: none; vertical-align: baseline;color: rgb(50, 105, 160);&quot;&gt;&lt;/a&gt;webpack 설정&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px;margin: 1em 0px; word-wrap: break-word;&quot;&gt;기본적으로 다음 folder 구조를 따른다. (maven 과 유사)&lt;/p&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;&quot;&gt;&lt;code class=&quot;cmd&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;cmd&amp;quot;&gt;├── dist
├── src
│   ├── app
│   └── public
├── package.json
├── tsconfig.json
├── typings.json
└── webpack.config.js
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;├── dist
├── src
│   ├── app
│   └── public
├── package.json
├── tsconfig.json
├── typings.json
└── webpack.config.js
&lt;/code&gt;&lt;/pre&gt;&lt;ul&gt;
&lt;li style=&quot;display: list-item; line-height: 1.4em;&quot;&gt;&lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;src/app&lt;/code&gt;: javascript application&lt;/li&gt;&lt;li style=&quot;display: list-item; line-height: 1.4em;&quot;&gt;&lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;src/public&lt;/code&gt;: html,css,image와 같이 static resource 구성&lt;/li&gt;&lt;/ul&gt;&lt;p style=&quot;margin: 1em 0px; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;typescript&lt;/code&gt;를 지원하기 위해서 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;awesome-typescript-loader&lt;/code&gt;을 설치하고 loader에 다음과 같이 등록한다. &lt;/p&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;display: block; overflow-x: auto; padding: 0.5em; color: rgb(101, 123, 131); background: rgb(253, 246, 227);&quot;&gt;&lt;code class=&quot;js&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;js&amp;quot;&gt;{
  test: /\.ts$/,
  loader: 'awesome-typescript-loader',
  exclude: /node_modules/
}
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;{
  test: &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;/\.ts$/&lt;/span&gt;,
  loader: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'awesome-typescript-loader'&lt;/span&gt;,
  exclude: &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;/node_modules/&lt;/span&gt;
}
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin: 1em 0px; word-wrap: break-word;&quot;&gt;webpack.config.js&lt;/p&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;display: block; overflow-x: auto; padding: 0.5em; color: rgb(101, 123, 131); background: rgb(253, 246, 227);&quot;&gt;&lt;code class=&quot;js&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;js&amp;quot;&gt;'use strict';

var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');

function buildConfig() {
  var isProd = false;
  const config = {
    output: {
      path: __dirname + '/dist',
      publicPath: isProd ? '/' : 'http://localhost:8080/',
      filename: isProd ? '[name].[hash].js' : '[name].bundle.js',
      chunkFilename: isProd ? '[name].[hash].js' : '[name].bundle.js'
    },
    resolve: {
      extensions: ['', '.webpack.js', '.web.js', '.ts', '.js'],
      modulesDirectories: [
        'node_modules'
      ]
    },
    devtool: 'cheap-source-map',
    module: {
      loaders: [
        {
          test: /\.ts$/,
          loader: 'awesome-typescript-loader',
          exclude: /node_modules/
        }
      ]
    },
    entry: {
      app: __dirname + '/src/app/app.ts'
    },
    plugins: [
      new webpack.NoErrorsPlugin(),
      new webpack.optimize.DedupePlugin(),
      new CopyWebpackPlugin([{ from: __dirname + '/src/public'}]),
      new HtmlWebpackPlugin({
        template: './src/public/index.html',
        inject: 'body'
      })
    ]
  };
  config.devServer = {
    contentBase: './dist',
    stats: 'minimal',
    outputPath: './dist'
  };

  return config;
}

module.exports = buildConfig();
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;&lt;span class=&quot;hljs-pi&quot; style=&quot;color: rgb(147, 161, 161);&quot;&gt;'use strict'&lt;/span&gt;;

&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;var&lt;/span&gt; webpack = &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(38, 139, 210);&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'webpack'&lt;/span&gt;);
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;var&lt;/span&gt; HtmlWebpackPlugin = &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(38, 139, 210);&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'html-webpack-plugin'&lt;/span&gt;);
&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;var&lt;/span&gt; CopyWebpackPlugin = &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(38, 139, 210);&quot;&gt;require&lt;/span&gt;(&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'copy-webpack-plugin'&lt;/span&gt;);

&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;function&lt;/span&gt; &lt;span class=&quot;hljs-title&quot; style=&quot;color: rgb(38, 139, 210);&quot;&gt;buildConfig&lt;/span&gt;&lt;span class=&quot;hljs-params&quot;&gt;()&lt;/span&gt; &lt;/span&gt;{
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;var&lt;/span&gt; isProd = &lt;span class=&quot;hljs-literal&quot;&gt;false&lt;/span&gt;;
  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;const&lt;/span&gt; config = {
    output: {
      path: __dirname + &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'/dist'&lt;/span&gt;,
      publicPath: isProd ? &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'/'&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'http://localhost:8080/'&lt;/span&gt;,
      filename: isProd ? &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'[name].[hash].js'&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'[name].bundle.js'&lt;/span&gt;,
      chunkFilename: isProd ? &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'[name].[hash].js'&lt;/span&gt; : &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'[name].bundle.js'&lt;/span&gt;
    },
    resolve: {
      extensions: [&lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;''&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'.webpack.js'&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'.web.js'&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'.ts'&lt;/span&gt;, &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'.js'&lt;/span&gt;],
      modulesDirectories: [
        &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'node_modules'&lt;/span&gt;
      ]
    },
    devtool: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'cheap-source-map'&lt;/span&gt;,
    &lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(38, 139, 210);&quot;&gt;module&lt;/span&gt;: {
      loaders: [
        {
          test: &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;/\.ts$/&lt;/span&gt;,
          loader: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'awesome-typescript-loader'&lt;/span&gt;,
          exclude: &lt;span class=&quot;hljs-regexp&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;/node_modules/&lt;/span&gt;
        }
      ]
    },
    entry: {
      app: __dirname + &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'/src/app/app.ts'&lt;/span&gt;
    },
    plugins: [
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;new&lt;/span&gt; webpack.NoErrorsPlugin(),
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;new&lt;/span&gt; webpack.optimize.DedupePlugin(),
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;new&lt;/span&gt; CopyWebpackPlugin([{ from: __dirname + &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'/src/public'&lt;/span&gt;}]),
      &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;new&lt;/span&gt; HtmlWebpackPlugin({
        template: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'./src/public/index.html'&lt;/span&gt;,
        inject: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'body'&lt;/span&gt;
      })
    ]
  };
  config.devServer = {
    contentBase: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'./dist'&lt;/span&gt;,
    stats: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'minimal'&lt;/span&gt;,
    outputPath: &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'./dist'&lt;/span&gt;
  };

  &lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;return&lt;/span&gt; config;
}

&lt;span class=&quot;hljs-built_in&quot; style=&quot;color: rgb(38, 139, 210);&quot;&gt;module&lt;/span&gt;.exports = buildConfig();
&lt;/code&gt;&lt;/pre&gt;&lt;h2 id=&quot;app.ts&quot; style=&quot;clear: both;font-size: 1.8em; font-weight: bold; margin: 1.275em 0px 0.85em;border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(230, 230, 230); line-height: 1.6;&quot;&gt;&lt;a name=&quot;app.ts&quot; href=&quot;#app.ts&quot; style=&quot;text-decoration: none; vertical-align: baseline;color: rgb(50, 105, 160);&quot;&gt;&lt;/a&gt;app.ts&lt;/h2&gt;&lt;p style=&quot;margin-top: 0px;margin: 1em 0px; word-wrap: break-word;&quot;&gt;webpack에서 지정되는 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;entry point&lt;/code&gt;가 된다. &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;main.ts&lt;/code&gt;, &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;bootstrap.ts&lt;/code&gt;등 다양한 파일이름이 있지만, 개인적으로는 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;app.ts&lt;/code&gt;가 가장 좋은것 같다. &lt;/p&gt;&lt;p style=&quot;margin: 1em 0px; word-wrap: break-word;&quot;&gt;&lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;app.ts&lt;/code&gt;에서는 다음 세가지 기능을 한다. &lt;/p&gt;&lt;ol style=&quot;list-style-type: decimal;&quot;&gt;
&lt;li style=&quot;display: list-item; line-height: 1.4em;&quot;&gt;router 의 등록&lt;/li&gt;&lt;li style=&quot;display: list-item; line-height: 1.4em;&quot;&gt;bootstrap 실행&lt;/li&gt;&lt;li style=&quot;display: list-item; line-height: 1.4em;&quot;&gt;첫페이지로 direction&lt;/li&gt;&lt;/ol&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;display: block; overflow-x: auto; padding: 0.5em; color: rgb(101, 123, 131); background: rgb(253, 246, 227);&quot;&gt;&lt;code class=&quot;typescript&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;typescript&amp;quot;&gt;/// &amp;amp;lt;reference path=&amp;quot;../../node_modules/angular2/typings/browser.d.ts&amp;quot; /&amp;amp;gt;

import 'core-js/es6';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import { bootstrap } from 'angular2/platform/browser';
import { HTTP_PROVIDERS } from 'angular2/http';
import { enableProdMode } from 'angular2/core';
import { Component } from 'angular2/core';
import { provide } from 'angular2/core';
import { Router, RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, LocationStrategy, Location, HashLocationStrategy } from 'angular2/router';

import { HeroService } from './hero.service';
import { DashboardComponent } from './dashboard.component';
import { HeroesComponent, HeroesRouterInfo } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component';

@RouteConfig([
  {
    path: '/heroes',
    name: 'Heroes',
    component: HeroesComponent,
  },
  HeroesRouterInfo,
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: DashboardComponent,
    useAsDefault: true
  },
  {
    path: '/detail/:id',
    name: 'HeroDetail',
    component: HeroDetailComponent
  },
])
@Component({
  selector: 'my-app',
  template: `
    &amp;amp;lt;h1&amp;amp;gt;{{title}}&amp;amp;lt;/h1&amp;amp;gt;
    &amp;amp;lt;nav&amp;amp;gt;
      &amp;amp;lt;a [routerLink]=&amp;quot;['Dashboard']&amp;quot;&amp;amp;gt;Dashboard&amp;amp;lt;/a&amp;amp;gt;
      &amp;amp;lt;a [routerLink]=&amp;quot;['Heroes']&amp;quot;&amp;amp;gt;Heroes&amp;amp;lt;/a&amp;amp;gt;
    &amp;amp;lt;/nav&amp;amp;gt;
    &amp;amp;lt;router-outlet&amp;amp;gt;&amp;amp;lt;/router-outlet&amp;amp;gt;
  `,
  styleUrls: ['app.component.css'],
  directives: [ROUTER_DIRECTIVES]
})
class AppComponent {
  title: string;
  router: Router;
  location: Location;
  constructor(router: Router, location: Location) {
    this.title = 'This is Title';
    this.router = router;
    this.location = location;
  }
}

// enableProdMode();
bootstrap(AppComponent, [
  HTTP_PROVIDERS,
  ROUTER_PROVIDERS,
  provide(LocationStrategy, { useClass: HashLocationStrategy }),
  HeroService
]).catch(err =&amp;amp;gt; console.error(err));
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;/// &amp;lt;reference path=&quot;../../node_modules/angular2/typings/browser.d.ts&quot; /&amp;gt;

import 'core-js/es6';
import 'core-js/es7/reflect';
import 'zone.js/dist/zone';
import { bootstrap } from 'angular2/platform/browser';
import { HTTP_PROVIDERS } from 'angular2/http';
import { enableProdMode } from 'angular2/core';
import { Component } from 'angular2/core';
import { provide } from 'angular2/core';
import { Router, RouteConfig, ROUTER_DIRECTIVES, ROUTER_PROVIDERS, LocationStrategy, Location, HashLocationStrategy } from 'angular2/router';

import { HeroService } from './hero.service';
import { DashboardComponent } from './dashboard.component';
import { HeroesComponent, HeroesRouterInfo } from './heroes.component';
import { HeroDetailComponent } from './hero-detail.component';

@RouteConfig([
  {
    path: '/heroes',
    name: 'Heroes',
    component: HeroesComponent,
  },
  HeroesRouterInfo,
  {
    path: '/dashboard',
    name: 'Dashboard',
    component: DashboardComponent,
    useAsDefault: true
  },
  {
    path: '/detail/:id',
    name: 'HeroDetail',
    component: HeroDetailComponent
  },
])
@Component({
  selector: 'my-app',
  template: `
    &amp;lt;h1&amp;gt;{{title}}&amp;lt;/h1&amp;gt;
    &amp;lt;nav&amp;gt;
      &amp;lt;a [routerLink]=&quot;['Dashboard']&quot;&amp;gt;Dashboard&amp;lt;/a&amp;gt;
      &amp;lt;a [routerLink]=&quot;['Heroes']&quot;&amp;gt;Heroes&amp;lt;/a&amp;gt;
    &amp;lt;/nav&amp;gt;
    &amp;lt;router-outlet&amp;gt;&amp;lt;/router-outlet&amp;gt;
  `,
  styleUrls: ['app.component.css'],
  directives: [ROUTER_DIRECTIVES]
})
class AppComponent {
  title: string;
  router: Router;
  location: Location;
  constructor(router: Router, location: Location) {
    this.title = 'This is Title';
    this.router = router;
    this.location = location;
  }
}

// enableProdMode();
bootstrap(AppComponent, [
  HTTP_PROVIDERS,
  ROUTER_PROVIDERS,
  provide(LocationStrategy, { useClass: HashLocationStrategy }),
  HeroService
]).catch(err =&amp;gt; console.error(err));
&lt;/code&gt;&lt;/pre&gt;&lt;p style=&quot;margin: 1em 0px; word-wrap: break-word;&quot;&gt;위 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;app.ts&lt;/code&gt;의 경우에는 router가 추가 되고, 여러 서비스 Provider들이 추가되는 것 이외에는 큰 차이가 없을것같다. 기본적으로 기존 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;angular&lt;/code&gt;의 &lt;code style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 85%; padding: 0.2em 0.5em; border: 0px; background-color: rgba(0, 0, 0, 0.0666667);&quot;&gt;app.js&lt;/code&gt;와 동일한 기능을 갖게 된다. &lt;/p&gt;&lt;h2 id=&quot;lodash-추가&quot; style=&quot;clear: both;font-size: 1.8em; font-weight: bold; margin: 1.275em 0px 0.85em;border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: rgb(230, 230, 230); line-height: 1.6;&quot;&gt;&lt;a name=&quot;lodash-추가&quot; href=&quot;#lodash-추가&quot; style=&quot;text-decoration: none; vertical-align: baseline;color: rgb(50, 105, 160);&quot;&gt;&lt;/a&gt;lodash 추가&lt;/h2&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;&quot;&gt;&lt;code class=&quot;cmd&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;cmd&amp;quot;&gt;typings install lodash --ambient --save
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;typings install lodash --ambient --save
&lt;/code&gt;&lt;/pre&gt;&lt;pre style=&quot;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); overflow: auto; padding: 0.5em;display: block; overflow-x: auto; padding: 0.5em; color: rgb(101, 123, 131); background: rgb(253, 246, 227);&quot;&gt;&lt;code class=&quot;typescript&quot; data-origin=&quot;&lt;pre&gt;&lt;code class=&amp;quot;typescript&amp;quot;&gt;import * as _ from 'lodash'
&lt;/code&gt;&lt;/pre&gt;&quot; style=&quot;border: 0px; display: block;font-family: Consolas, Inconsolata, Courier, monospace; font-weight: bold; white-space: pre; margin: 0px;border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px; word-wrap: break-word; border: 1px solid rgb(204, 204, 204); padding: 0px 5px; margin: 0px 2px;font-size: 0.9em; font-family: Consolas, Inconsolata, Courier, monospace;&quot;&gt;&lt;span class=&quot;hljs-keyword&quot; style=&quot;color: rgb(133, 153, 0);&quot;&gt;import&lt;/span&gt; * as _ from &lt;span class=&quot;hljs-string&quot; style=&quot;color: rgb(42, 161, 152);&quot;&gt;'lodash'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;</description>
      <category>Dynamic Language</category>
      <category>angular2</category>
      <category>html</category>
      <category>js</category>
      <category>TypeScript</category>
      <category>webpack</category>
      <author>Y2K</author>
      <guid isPermaLink="true">https://netframework.tistory.com/449</guid>
      <comments>https://netframework.tistory.com/entry/angular2-webpack-%EA%B0%9C%EB%B0%9C#entry449comment</comments>
      <pubDate>Tue, 19 Apr 2016 10:20:30 +0900</pubDate>
    </item>
  </channel>
</rss>