<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Harris Lee on Medium]]></title>
        <description><![CDATA[Stories by Harris Lee on Medium]]></description>
        <link>https://medium.com/@harris.lee121089?source=rss-3120d707f1a7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*r3YvZa7zb-Cdu2e4.</url>
            <title>Stories by Harris Lee on Medium</title>
            <link>https://medium.com/@harris.lee121089?source=rss-3120d707f1a7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 23:52:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@harris.lee121089/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[AngularJS/ Node.js/MySQL Todo Application (Part I)]]></title>
            <link>https://medium.com/@harris.lee121089/angularjs-node-js-mysql-todo-application-part-i-9cf8410c8716?source=rss-3120d707f1a7------2</link>
            <guid isPermaLink="false">https://medium.com/p/9cf8410c8716</guid>
            <category><![CDATA[angularjs]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Harris Lee]]></dc:creator>
            <pubDate>Sun, 18 Sep 2016 23:28:40 GMT</pubDate>
            <atom:updated>2016-09-18T23:28:40.311Z</atom:updated>
            <content:encoded><![CDATA[<p>Below is the step-by-step instruction on creating a simple Todo application using AngularJS(front-end), Node.js/Express (server-side), and MySQL(relational database). This part will cover the client side of web application.</p><p>Front-End (AngularJS)<br>Lets go create two files in directory:<br>1) index.html<br>2) todo.js<br>Dev Setup for AngularJS is quite simple using either Bower install or script tag. For this tutorial, let’s include a script tag below onto index.html</p><pre>&lt;script src=&quot;<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js</a>&quot;&gt;&lt;/script&gt;</pre><p>Check out this <a href="https://thinkster.io/egghead/intro-to-bower">blog</a> for details on using bower.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>  &lt;meta charset=&quot;UTF-8&quot;&gt;<br>  &lt;script src=&quot;<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js</a>&quot;&gt;&lt;/script&gt;<br>  &lt;script src=&quot;todo.js&quot;&gt;&lt;/script&gt;</pre><pre>&lt;title&gt;Todo Application&lt;/title&gt;</pre><pre>&lt;/head&gt;<br>&lt;body ng-app=&quot;myApp&quot; ng-controller=&quot;todoCtrl&quot;&gt;<br>&lt;/body&gt;</pre><pre>&lt;/html&gt;</pre><p>You will find (index.html) “ng-app” inside the body tag. This is a simple way to say “I want to use angular module called ‘myApp’ and angular controller called ‘todoCtrl’ to make this page interactive”.</p><p>And that is it! We are now ready to use Angular on index.html. We will get to ‘ng’ stuff later. For now, let’s continue to fill out our index.html page with forms for writing and submitting our Todo lists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/644/1*WK0Le2ObG3EFuK_dHuyBWQ.png" /><figcaption>index.html</figcaption></figure><p>Inside &lt;body&gt; on index.html, lets type in codes above. This block of code builds header “My Todo List” and a form that includes:<br>1) input space where you type in your todos<br>2) submit button that will trigger “todoAdd()” which will be specified in angular module in Todo.js</p><p>Now, let’s create this angular module that we’ve reference in index.html as “ng-app = todo”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*swNl_LeiFDdxQM5MK29dFw.png" /><figcaption>todo.js</figcaption></figure><p>Inside the <a href="https://docs.angularjs.org/guide/controller">controller</a>, we have a $scope object that we can access from our index.html. This time, we will store todoList as a property of $scope which will include array of todo list. We would like to use $scope.todoList to display on our application and to be able to removed when task is finished.</p><p>Inside $scope object, you can also add a method. This method is invoked on index.html when we click a submit button(‘ng-submit’).</p><p>Let’s go back to our index.html and have this todo list show up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*aIiqliRHtJmbIKbHSIii7w.png" /><figcaption>index.html</figcaption></figure><p>Below our form in index.html, we are adding a &lt;div&gt; tag using ng-repeat. “x in todoList” is same as $scope.todoList[i]. It’s going to return all indices inside our todoList array and put it inside &lt;span&gt;&lt;/span&gt;. We also have &lt;input type=”checkbox”&gt;. Lastly, there is a button that triggers remove() method inside our $scope.</p><p>Now let’s go back to our module and add in ‘remove todolist’ functionality.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/614/1*xmaTxgMolx-BbxHnLIbdhw.png" /><figcaption>todo.js</figcaption></figure><p>This method will remove the todoList that are checked as ‘done’ in checkbox. Now you have a simple todo application in your hand. Below is the code put all together:</p><ol><li>todo.js</li></ol><pre>var app = angular.module(&#39;myApp&#39;, []);<br>app.controller(&#39;todoCtrl&#39;, function($scope) {<br>    $scope.todoList = [{todoText:&#39;Clean House&#39;, done:false}];</pre><pre>$scope.todoAdd = function() {<br>        $scope.todoList.push({todoText:$scope.todoInput, done:false});<br>        $scope.todoInput = &quot;&quot;;<br>    };</pre><pre>$scope.remove = function() {<br>        var oldList = $scope.todoList;<br>        $scope.todoList = [];<br>        angular.forEach(oldList, function(x) {<br>            if (!x.done) $scope.todoList.push(x);<br>        });<br>    };<br>});</pre><p>2. Index.html</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;script src=&quot;<a href="http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js">http://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js</a>&quot;&gt;&lt;/script&gt;<br>&lt;script src=&quot;todo.js&quot;&gt;&lt;/script&gt;<br>&lt;body ng-app=&quot;myApp&quot; ng-controller=&quot;todoCtrl&quot;&gt;</pre><pre>&lt;h2&gt;My Todo List&lt;/h2&gt;</pre><pre>&lt;form ng-submit=&quot;todoAdd()&quot;&gt;<br>    &lt;input type=&quot;text&quot; ng-model=&quot;todoInput&quot; size=&quot;50&quot; placeholder=&quot;Add New&quot;&gt;<br>    &lt;input type=&quot;submit&quot; value=&quot;Add New&quot;&gt;<br>&lt;/form&gt;</pre><pre>&lt;br&gt;</pre><pre>&lt;div ng-repeat=&quot;x in todoList&quot;&gt;<br>    &lt;input type=&quot;checkbox&quot; ng-model=&quot;x.done&quot;&gt; &lt;span ng-bind=&quot;x.todoText&quot;&gt;&lt;/span&gt;<br>&lt;/div&gt;</pre><pre>&lt;p&gt;&lt;button ng-click=&quot;remove()&quot;&gt;Remove marked&lt;/button&gt;&lt;/p&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>In part II, lets set up back-end and database to make our data persist.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9cf8410c8716" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>