<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="FeedCreator 1.8" -->
<?xml-stylesheet href="https://wiki.chongtin.com/lib/exe/css.php?s=feed" type="text/css"?>
<rdf:RDF
    xmlns="http://purl.org/rss/1.0/"
    xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
    xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
    xmlns:dc="http://purl.org/dc/elements/1.1/">
    <channel rdf:about="https://wiki.chongtin.com/feed.php">
        <title>Tutorial Site ng</title>
        <description></description>
        <link>https://wiki.chongtin.com/</link>
        <image rdf:resource="https://wiki.chongtin.com/ttps://wiki.chongtin.com/lib/tpl/bootstrap3/images/favicon.ico" />
       <dc:date>2026-04-09T00:04:25+00:00</dc:date>
        <items>
            <rdf:Seq>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/add_dialog_component_from_angular_material?do=revisions&amp;rev=1549932823"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/adding_router_to_app?do=revisions&amp;rev=1574817829"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/build_project_that_needs_to_use_a_lot_of_memory?do=revisions&amp;rev=1557908230"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/create_a_new_project?do=revisions&amp;rev=1545357517"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/creating_component?do=revisions&amp;rev=1574057939"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/directive_ngclass?do=revisions&amp;rev=1574067616"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/directive_ngfor?do=revisions&amp;rev=1574069078"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/directive_ngif?do=revisions&amp;rev=1574064036"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/directive_ngstyle?do=revisions&amp;rev=1574067663"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/eventemitter?do=revisions&amp;rev=1574157382"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/input_output_for_child_and_parent_component_communication?do=revisions&amp;rev=1574395295"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/installing_angular_command_line_interface_cli?do=revisions&amp;rev=1545357094"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/observable_interval_subscription?do=revisions&amp;rev=1552466181"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/proxy_to_back-end_for_development?do=revisions&amp;rev=1546394168"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/reactive_form?do=revisions&amp;rev=1574742340"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/service?do=revisions&amp;rev=1574153685"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/template_driven_form?do=revisions&amp;rev=1574411210"/>
                <rdf:li rdf:resource="https://wiki.chongtin.com/ng/using_material_auto_complete?do=revisions&amp;rev=1557130425"/>
            </rdf:Seq>
        </items>
    </channel>
    <image rdf:about="https://wiki.chongtin.com/ttps://wiki.chongtin.com/lib/tpl/bootstrap3/images/favicon.ico">
        <title>Tutorial Site</title>
        <link>https://wiki.chongtin.com/</link>
        <url>https://wiki.chongtin.com/ttps://wiki.chongtin.com/lib/tpl/bootstrap3/images/favicon.ico</url>
    </image>
    <item rdf:about="https://wiki.chongtin.com/ng/add_dialog_component_from_angular_material?do=revisions&amp;rev=1549932823">
        <dc:format>text/html</dc:format>
        <dc:date>2019-02-12T08:53:43+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Add Dialog Component from Angular Material</title>
        <link>https://wiki.chongtin.com/ng/add_dialog_component_from_angular_material?do=revisions&amp;rev=1549932823</link>
        <description>Add Dialog Component from Angular Material

Basic Dialog

	*  Install @angular/material by npm command.
	*  Create a new component by ng g c command.
	*  Assume the name of the new component is AlertDialogComponent, and it only display an alert message with an OK button. The TS file would be: (Note: this constructor take a</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/adding_router_to_app?do=revisions&amp;rev=1574817829">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-27T09:23:49+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Adding Router to App</title>
        <link>https://wiki.chongtin.com/ng/adding_router_to_app?do=revisions&amp;rev=1574817829</link>
        <description>Adding Router to App

Add the Routing Module

app-routing.module.ts will be add to project with the following code:

ng generate module app-routing --flat --module=app

Add Component for Routing to

Add a component for the router to route to. Here we have a component called</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/build_project_that_needs_to_use_a_lot_of_memory?do=revisions&amp;rev=1557908230">
        <dc:format>text/html</dc:format>
        <dc:date>2019-05-15T16:17:10+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Build Project that Needs to Use a Lot of Memory</title>
        <link>https://wiki.chongtin.com/ng/build_project_that_needs_to_use_a_lot_of_memory?do=revisions&amp;rev=1557908230</link>
        <description>Build Project that Needs to Use a Lot of Memory

Normally, we build angular project with


ng build --prod --base-href /YOUR_BASE_HREF/ --env=prod


but ng command uses at most 4GB ram to build the source, and it might not enough for some big project. We can use node command directly to build it. Go to your project directory and try:</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/create_a_new_project?do=revisions&amp;rev=1545357517">
        <dc:format>text/html</dc:format>
        <dc:date>2018-12-21T09:58:37+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Create a New Project</title>
        <link>https://wiki.chongtin.com/ng/create_a_new_project?do=revisions&amp;rev=1545357517</link>
        <description>Create a New Project

Here we will create a front end call my-app, and run it as a serve. You can visit it with a web browser at &lt;http://127.0.0.1:4200&gt; afterward. 127.0.0.1 is the local host of your computer, and 4200 is the default angular serve port. This setting is good for developing and debugging. Note that create a new app take time for angular cli to download the dependencies from the web.</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/creating_component?do=revisions&amp;rev=1574057939">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-18T14:18:59+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Creating Component</title>
        <link>https://wiki.chongtin.com/ng/creating_component?do=revisions&amp;rev=1574057939</link>
        <description>Creating Component

Using CLI

We can use console line input (CLI) to generate new angular component, where componentName is the name of your component.

ng generate component componentName

It can be simply as:

ng g c componentName
CREATE src/app/component-name/component-name.component.html (33 bytes)
CREATE src/app/component-name/component-name.component.spec.ts (678 bytes)
CREATE src/app/component-name/component-name.component.ts (300 bytes)
CREATE src/app/component-name/component-name.compo…</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/directive_ngclass?do=revisions&amp;rev=1574067616">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-18T17:00:16+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Directive ngClass</title>
        <link>https://wiki.chongtin.com/ng/directive_ngclass?do=revisions&amp;rev=1574067616</link>
        <description>Directive ngClass

Assume we have a component called servers. ngClass directive can dynamically change the CSS class of an element. Different from ngStyle, we need a to use the component CSS file this time to set the style.


servers.component.html</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/directive_ngfor?do=revisions&amp;rev=1574069078">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-18T17:24:38+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Directive *ngFor</title>
        <link>https://wiki.chongtin.com/ng/directive_ngfor?do=revisions&amp;rev=1574069078</link>
        <description>Directive *ngFor

Assume we have a component called servers. ngFor takes an array, and loop them through. {{}} is the way to bind the value from JavaScript/Type Script to HTML. Of course, the hList in our example can be change dynamically, and the UI will refresh if it is changed.</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/directive_ngif?do=revisions&amp;rev=1574064036">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-18T16:00:36+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Directive *ngIf</title>
        <link>https://wiki.chongtin.com/ng/directive_ngif?do=revisions&amp;rev=1574064036</link>
        <description>Directive *ngIf

We can use ngIf directive to control an UI element to show or not. The syntax is:

&lt;DOM_ELEMENT *ngIf=&quot;condition_expression&quot;&gt; ...THE CONTENT... &lt;/DOM_ELEMENT&gt;

DOM_ELEMENT can be like &lt;div&gt;, &lt;p&gt;, or anything HTML tag. The condition_expression could be a Boolean variable or a function that return Boolean result.</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/directive_ngstyle?do=revisions&amp;rev=1574067663">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-18T17:01:03+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Directive ngStyle</title>
        <link>https://wiki.chongtin.com/ng/directive_ngstyle?do=revisions&amp;rev=1574067663</link>
        <description>Directive ngStyle

Assume we have a component called servers. By clicking the button, the font size of the text will increase, and the background color of it will change.


servers.component.html

Here we user binding for our ngStyle directive. The value of each</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/eventemitter?do=revisions&amp;rev=1574157382">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-19T17:56:22+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>EventEmitter</title>
        <link>https://wiki.chongtin.com/ng/eventemitter?do=revisions&amp;rev=1574157382</link>
        <description>EventEmitter

We can use event emitter with service to achieve cross components communication. Assume we have two components called servers and another, and a service called data We want to emit a signal when the buttons on servers is clicked, and the</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/input_output_for_child_and_parent_component_communication?do=revisions&amp;rev=1574395295">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-22T12:01:35+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>@Input() @Output() for Child and Parent Component Communication</title>
        <link>https://wiki.chongtin.com/ng/input_output_for_child_and_parent_component_communication?do=revisions&amp;rev=1574395295</link>
        <description>@Input() @Output() for Child and Parent Component Communication

This example shows how @Input, @Output decorations work. To make is simple to read, this example is actually doing something not so particle in the real world...

Create a parent and child component</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/installing_angular_command_line_interface_cli?do=revisions&amp;rev=1545357094">
        <dc:format>text/html</dc:format>
        <dc:date>2018-12-21T09:51:34+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Installing Angular Command Line Interface(CLI)</title>
        <link>https://wiki.chongtin.com/ng/installing_angular_command_line_interface_cli?do=revisions&amp;rev=1545357094</link>
        <description>Installing Angular Command Line Interface(CLI)

	*  Install Node.js. Install Node.js
	*  Run npm install -g @angular/cli in terminal (cmd)
	*  Wait for it! It really takes time.

If you want to install a specific version of Angular CLI, say version 1.7.3, you can run</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/observable_interval_subscription?do=revisions&amp;rev=1552466181">
        <dc:format>text/html</dc:format>
        <dc:date>2019-03-13T16:36:21+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Observable Interval Subscription</title>
        <link>https://wiki.chongtin.com/ng/observable_interval_subscription?do=revisions&amp;rev=1552466181</link>
        <description>Observable Interval Subscription

The following example show how to setup a observable interval for 5 seconds. Note that observable interval will call the callback function periodically, in this case 5 seconds each, until it has been unsubscribe(). Since we unsubscribe the observable in the callback function here, it would than be a one time call. It is important to unsubscribe the observable interval once your are done with it, or it will cause memory leakage once your leave the component conta…</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/proxy_to_back-end_for_development?do=revisions&amp;rev=1546394168">
        <dc:format>text/html</dc:format>
        <dc:date>2019-01-02T09:56:08+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Proxy to Back-end For Development</title>
        <link>https://wiki.chongtin.com/ng/proxy_to_back-end_for_development?do=revisions&amp;rev=1546394168</link>
        <description>Proxy to Back-end For Development

	*  Create a file call proxy.conf.json in the root directory of your project.
	*  Fill the config in proxy.conf.json: 

  {
  &quot;/BACKEND_SERVER_URL/*&quot;: {
    &quot;target&quot;: &quot;http://localhost:8080/BACKEND_SERVER_URL/&quot;,
    &quot;secure&quot;: false,
    &quot;logLevel&quot;: &quot;debug&quot;,
    &quot;changeOrigin&quot;: false,
    &quot;pathRewrite&quot;: {
        &quot;^/BACKEND_SERVER_URL&quot;: &quot;&quot;
    }
    , &quot;headers&quot;: {&quot;ipaddress&quot;:&quot;127.0.0.1&quot;}
  }
}</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/reactive_form?do=revisions&amp;rev=1574742340">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-26T12:25:40+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Reactive Form</title>
        <link>https://wiki.chongtin.com/ng/reactive_form?do=revisions&amp;rev=1574742340</link>
        <description>Reactive Form

This example shows how to create a reactive form in code, and bind it to the HTML UI.

Codes are form &lt;https://www.udemy.com/course/the-complete-guide-to-angular-2/learn/lecture/6656504#overview&gt;. His course is good, I learn most of the Angular stuff from him.

reactive-form.component.ts

First we create a FormGroup instance in our code. Then we setup the struct of this from group on</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/service?do=revisions&amp;rev=1574153685">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-19T16:54:45+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Service</title>
        <link>https://wiki.chongtin.com/ng/service?do=revisions&amp;rev=1574153685</link>
        <description>Service

Angular services can be called by different component in your project through Angular dependency injection. If we use Angualt dependency injection, services are singleton, meaning that every component that use the service is using the same instance.</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/template_driven_form?do=revisions&amp;rev=1574411210">
        <dc:format>text/html</dc:format>
        <dc:date>2019-11-22T16:26:50+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Template Driven Form</title>
        <link>https://wiki.chongtin.com/ng/template_driven_form?do=revisions&amp;rev=1574411210</link>
        <description>Template Driven Form

In order to use ngForm, we need to import the Form module ni app.module.ts and your component.

component.html

When the submit button is clicked, we have the form to call function logForm(form.value).


&lt;form #form=&quot;ngForm&quot; (ngSubmit)=&quot;logForm(form.value)&quot;&gt;
  &lt;label&gt;Firstname:&lt;/label&gt;
  &lt;input type=&quot;text&quot; name=&quot;firstName&quot; ngModel&gt;
  &lt;br&gt;
  &lt;label&gt;Lastname:&lt;/label&gt;
  &lt;input type=&quot;text&quot; name=&quot;lastName&quot; ngModel&gt;
  &lt;br&gt;
  &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
&lt;/form&gt;</description>
    </item>
    <item rdf:about="https://wiki.chongtin.com/ng/using_material_auto_complete?do=revisions&amp;rev=1557130425">
        <dc:format>text/html</dc:format>
        <dc:date>2019-05-06T16:13:45+00:00</dc:date>
        <dc:creator>Anonymous (anonymous@undisclosed.example.com)</dc:creator>
        <title>Using Material Auto Complete</title>
        <link>https://wiki.chongtin.com/ng/using_material_auto_complete?do=revisions&amp;rev=1557130425</link>
        <description>Using Material Auto Complete

Installing the Related Dependencies

npm install --save @angular/material @angular/cdk @angular/animation

Adding the Module in app.module.ts


...
  imports: [
    BrowserModule,
    AppRoutingModule,

    BrowserAnimationsModule,
    MatAutocompleteModule,
    MatInputModule,
    FormsModule,
    ReactiveFormsModule
  ],
...</description>
    </item>
</rdf:RDF>
