<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	 xmlns:media="http://search.yahoo.com/mrss/" >

<channel>
	<title>the javascript &#8211; Codemotion</title>
	<atom:link href="https://codemotion.us/tag/the-javascript/feed/" rel="self" type="application/rss+xml" />
	<link>https://codemotion.us</link>
	<description>NodeJS, AngularJS, Meteor, Javascript outsourcing Ukraine</description>
	<lastBuildDate>Tue, 18 Dec 2018 22:24:22 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://codemotion.us/wp-content/uploads/2023/08/CDM-Logomark-Small.png</url>
	<title>the javascript &#8211; Codemotion</title>
	<link>https://codemotion.us</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Anton Smirnov &#8211; JavaScript Architect, Codemotion</title>
		<link>https://codemotion.us/sa-codemotion-ninjas-team/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Tue, 13 Nov 2018 18:22:17 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Hire JavaScript Developer]]></category>
		<category><![CDATA[JS ninja]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=7083</guid>

					<description><![CDATA[<p>Meet Codemotion Ninjas Team Hello! My name is Anton and I`m JavaScript Architect at Codemotion. My professional record as a software developer is more than 5 years. During this time I was the technical lead in fintech, logistics and IoT projects. My latest project is related to app for limiting internet connection, access to content [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/sa-codemotion-ninjas-team/">Anton Smirnov &#8211; JavaScript Architect, Codemotion</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Meet Codemotion Ninjas Team</h2>
<p><iframe src="https://www.youtube.com/embed/MMLb5UkcaCk" width="100%" height="500" frameborder="0" allowfullscreen="allowfullscreen"></iframe><br />
Hello! My name is Anton and I`m JavaScript Architect at Codemotion. My professional record as a software developer is more than 5 years. During this time I was the technical lead in fintech, logistics and IoT projects. My latest project is related to app for limiting internet connection, access to content for different devices in your network together with graphical reports.</p>
<p>Also, I`m a mentor for Junior developers in Codemotion and I like to improve the professional skills of my colleagues. In my free time, I like football, traveling and reading. I`m looking forward to delivering outstanding results to your project!</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/sa-codemotion-ninjas-team/">Anton Smirnov &#8211; JavaScript Architect, Codemotion</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
		<media:content url="https://www.youtube.com/embed/MMLb5UkcaCk" duration="96">
			<media:player url="https://www.youtube.com/embed/MMLb5UkcaCk" />
			<media:title type="html">Anton Smirnov - JavaScript Architect, Codemotion - Codemotion</media:title>
			<media:description type="html">Meet Codemotion Ninjas Team Hello! My name is Anton and I`m JavaScript Architect at Codemotion. My professional record as a software developer is more than 5 years. During this time I was the technical lead in fintech, logistics and IoT projects. My latest project is related to app for limiting inte</media:description>
			<media:thumbnail url="https://codemotion.ninja/wp-content/uploads/2018/11/mmlb5ukcack.jpg" />
			<media:keywords>Hire JavaScript Developer,JS ninja,the javascript,Codemotion, Js Development, Web Development</media:keywords>
		</media:content>
	</item>
		<item>
		<title>Vitaliy Kushnir &#8211; JavaScript Architect, Codemotion</title>
		<link>https://codemotion.us/vitk-codemotion-ninjas-team/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Tue, 06 Nov 2018 19:12:26 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Hire JavaScript Developer]]></category>
		<category><![CDATA[JS ninja]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=7214</guid>

					<description><![CDATA[<p>Meet Codemotion Ninjas Team Hi there! My name is Vitaliy and I`m JavaScript Architect from Codemotion. I have strong JavaScript expertise, so framework really doesn&#8217;t matter &#8211; I can lead any technical project, that requires high-level architect solutions. I can help to launch your MVP in the shortest term, considering business logic and save your [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/vitk-codemotion-ninjas-team/">Vitaliy Kushnir &#8211; JavaScript Architect, Codemotion</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Meet Codemotion Ninjas Team</h2>
<p><iframe src="https://www.youtube.com/embed/WXEaUxd-NpY" width="100%" height="500" frameborder="0" allowfullscreen="allowfullscreen"></iframe><br />
Hi there! My name is Vitaliy and I`m JavaScript Architect from Codemotion. I have strong JavaScript expertise, so framework really doesn&#8217;t matter &#8211; I can lead any technical project, that requires high-level architect solutions.</p>
<p>I can help to launch your MVP in the shortest term, considering business logic and save your app development from fail.</p>
<p>As to my personal interests, I`m a big fan of cars and I drive BMW, but my latest project was web-shop with ERP system for Mercedes goods. Thanks for watching my video! Let`s work!</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/vitk-codemotion-ninjas-team/">Vitaliy Kushnir &#8211; JavaScript Architect, Codemotion</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
		<media:content url="https://www.youtube.com/embed/WXEaUxd-NpY" duration="96">
			<media:player url="https://www.youtube.com/embed/WXEaUxd-NpY" />
			<media:title type="html">Vitaliy Kushnir - JavaScript Architect, Codemotion - Codemotion</media:title>
			<media:description type="html">Meet Codemotion Ninjas Team Hi there! My name is Vitaliy and I`m JavaScript Architect from Codemotion. I have strong JavaScript expertise, so framework really doesn&#039;t matter - I can lead any technical project, that requires high-level architect solutions. I can help to launch your MVP in the shortes</media:description>
			<media:thumbnail url="https://codemotion.ninja/wp-content/uploads/2018/11/wxeauxd-npy.jpg" />
			<media:keywords>Hire JavaScript Developer,JS ninja,the javascript,Codemotion, Js Development, Web Development</media:keywords>
		</media:content>
	</item>
		<item>
		<title>Dennis Yarmosh &#8211; JavaScript Lead, Codemotion</title>
		<link>https://codemotion.us/dy-codemotion-ninjas-team/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Mon, 08 Oct 2018 18:46:10 +0000</pubDate>
				<category><![CDATA[Blog]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Hire JavaScript Developer]]></category>
		<category><![CDATA[JS ninja]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=7101</guid>

					<description><![CDATA[<p>Meet Codemotion Ninjas Team Hi guys! My name is Dennis and I`m Backend Developer in Codemotion. I know every lifehack and pitfall in Backend, and also I have Business Analyst experience, so I can develop your app considering all business needs, not just coding. I`m very open person, I like wakeboarding, roller blading and travelling. [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/dy-codemotion-ninjas-team/">Dennis Yarmosh &#8211; JavaScript Lead, Codemotion</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Meet Codemotion Ninjas Team</h2>
<p><iframe src="https://www.youtube.com/embed/xPm9O_-esQ0" width="100%" height="500" frameborder="0" allowfullscreen="allowfullscreen"></iframe><br />
Hi guys! My name is Dennis and I`m Backend Developer in Codemotion. I know every lifehack and pitfall in Backend, and also I have Business Analyst experience, so I can develop your app considering all business needs, not just coding.</p>
<p>I`m very open person, I like wakeboarding, roller blading and travelling. If you want to develop a great app &#8211; just let me know! Thanks for watching my video! Bye!</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/dy-codemotion-ninjas-team/">Dennis Yarmosh &#8211; JavaScript Lead, Codemotion</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
		<media:content url="https://www.youtube.com/embed/xPm9O_-esQ0" duration="96">
			<media:player url="https://www.youtube.com/embed/xPm9O_-esQ0" />
			<media:title type="html">Dennis Yarmosh - JavaScript Lead, Codemotion - Codemotion</media:title>
			<media:description type="html">Meet Codemotion Ninjas Team Hi guys! My name is Dennis and I`m Backend Developer in Codemotion. I know every lifehack and pitfall in Backend, and also I have Business Analyst experience, so I can develop your app considering all business needs, not just coding. I`m very open person, I like wakeboard</media:description>
			<media:thumbnail url="https://codemotion.ninja/wp-content/uploads/2018/11/xpm9o_-esq0.jpg" />
			<media:keywords>Hire JavaScript Developer,JS ninja,the javascript,Codemotion, Js Development, Web Development</media:keywords>
		</media:content>
	</item>
		<item>
		<title>Writing Services in Angular.js</title>
		<link>https://codemotion.us/writing-services-angular-js/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Mon, 11 Sep 2017 15:28:01 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5084</guid>

					<description><![CDATA[<p>Series &#8220;Developing applications on single-Angular.js&#8221; Why do I need Angular.js and why he Modern tools and framework Angular.js frontend applications Familiarity with controllers and directives Angular.js Writing Services in Angular.js Routing in Angular.js How to connect to the API backend Angular.js In a previous article, we have recovered a list of transactions and added the [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/writing-services-angular-js/">Writing Services in Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Series &#8220;Developing applications on single-Angular.js&#8221;</h2>
<ol>
<li><a href="https://codemotion.ninja/blog/development/why-do-i-need-angular-js">Why do I need Angular.js and why he</a></li>
<li><a href="https://codemotion.ninja/blog/development/modern-tools-framework-angular-js-frontend-applications">Modern tools and framework Angular.js frontend applications</a></li>
<li><a href="https://codemotion.ninja/blog/development/familiarity-controllers-directives-angular-js">Familiarity with controllers and directives Angular.js</a></li>
<li>Writing Services in Angular.js</li>
<li><a href="https://codemotion.ninja/blog/development/routing-angular-js">Routing in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/connect-api-backend-angular-js">How to connect to the API backend Angular.js</a></li>
</ol>
<p>In a <a href="https://codemotion.ninja/blog/development/familiarity-controllers-directives-angular-js">previous article</a>, we have recovered a list of transactions and added the ability to add new transaction. However, as we have seen it is not related to transactions in the sidebar of our application, the total amount of money. In fact, it&#8217;s just text, registered in the html code.</p>
<p>In this article we will look at service facilities available in Angular.js. We will use the services as a single place for access to our transactions, which will allow us to get the data in different controllers. As we look at Dependency Injection in Angular.js.</p>
<p>In Angular.js available whole zoo of different types of service facilities. The most popular of these are the <code>factory</code> and <code>service</code>. Each service is a singleton, that is, there is only one instance of a particular service. It fits perfectly in our terms and conditions: a single point of access to transactions, available from any of the controllers.</p>
<p>Today we are going to use <code>factory</code>, and soon you will understand why.</p>
<p>Let&#8217;s start by adding a new file: <code>src/components/transactions_store.service.js</code> with the following content:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/components/transactions_store.service.js
angular.module('ngmkdev').factory('TransactionsStore', function() {
  return {
    transactions: []
  }
});</pre>
<p>Unlike the controllers, with the services we have more freedom in choosing the name. In this case, <code>TransactionsStore</code> makes sense, because the service will store all of the current transaction.</p>
<p>Now we need to combine this service with <code>TransactionsCtrl</code>. In Angular.js pattern used Dependency Injection. The framework itself is able to resolve the required dependencies, the developer only needs to specify the name of the component that is needed other component applications. It looks to specify dependencies as follows:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/main/transactions.controller.js
angular.module('ngmkdev').controller('TransactionsCtrl', function($scope, TransactionsStore) {
  // ...
});</pre>
<p>Now we have access to our service from the controller for the transaction. Since we used the factory, when you call <code>TransactionsStore</code> function is called from the definition of this service, so we can easily get all the transactions and write their controller attributes as follows:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/main/transactions.controller.js
angular.module('ngmkdev').controller('TransactionsCtrl', function($scope, TransactionsStore) {
  this.transactions = TransactionsStore.transactions;
  // ...
});</pre>
<p>Note that the rest of the code remains the same &#8211; Angular.js takes care of the communication controller attribute <code>transactions</code> and service upgrade.</p>
<p>Now we verify functionality in our service. We perform a number of operations are already familiar:</p>
<p>Add a new controller <code>src/app/main/navigation.controller.js</code>, in charge of the side menu in your application:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/main/navigation.controller.js
angular.module('ngmkdev').controller('NavigationCtrl', function(TransactionsStore) {
  this.transactions = TransactionsStore.transactions;
});</pre>
<p>We define it on the sidebar and derive the number of transactions in the parentheses after the item Transactions:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;

&lt;!-- ... --&gt;
&lt;div class="col-xs-2" ng-controller="NavigationCtrl as navigation_ctrl"&gt;
  &lt;h2&gt;Money&lt;/h2&gt;
  &lt;h3 class="money-ok"&gt;
    500.0
  &lt;/h3&gt;
  &lt;ul class="nav nav-pills nav-stacked"&gt;
    &lt;li&gt;
      &lt;a href="#"&gt;
        &lt;i class="glyphicon glyphicon-th-list"&gt;&lt;/i&gt;
        Transactions &lt;span class="badge"&gt;{{navigation_ctrl.transactions.length}}&lt;/span&gt;
      &lt;/a&gt;
    &lt;/li&gt;
    &lt;li&gt;
      &lt;a href="#"&gt;&lt;i class="glyphicon glyphicon-tasks"&gt;&lt;/i&gt; Settings&lt;/a&gt;
    &lt;/li&gt;
  &lt;/ul&gt;
&lt;/div&gt;
&lt;!-- ... --&gt;</pre>
<p>Reload the page in the browser (if gulp still has not done so) and try to add a transaction. In addition to updating the table with the transaction is automatically updated and the counter transactions in the sidebar.</p>
<p>Commit all changes, as always, in a project repository on the GitHub: <a href="https://github.com/mkdev-me/ng.mkdev/commit/6d661c0a5ecbbab2098490df23e5a2e9130f2564" target="_blank" rel="nofollow noopener">6d661c0</a></p>
<p>Homework ( <a href="https://github.com/mkdev-me/ng.mkdev/commit/d6051f50878a65a1645cb7539b9e639afc33513c" target="_blank" rel="nofollow noopener">tips</a> ):</p>
<p>Replace static amount of transactions in the sidebar to the present.<br />
Hide the table if you do not have any transactions</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/writing-services-angular-js/">Writing Services in Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
	</item>
		<item>
		<title>Routing in Angular.js</title>
		<link>https://codemotion.us/routing-angular-js/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Mon, 04 Sep 2017 15:52:11 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5088</guid>

					<description><![CDATA[<p>Series &#8220;Developing applications on single-Angular.js&#8221; Why do I need Angular.js and why he Modern tools and framework Angular.js frontend applications Familiarity with controllers and directives Angular.js Writing Services in Angular.js Routing in Angular.js How to connect to the API backend Angular.js We are approaching the end of our guidance for Angular.js. There are only two [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/routing-angular-js/">Routing in Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Series &#8220;Developing applications on single-Angular.js&#8221;</h2>
<ol>
<li><a href="https://codemotion.ninja/blog/development/why-do-i-need-angular-js">Why do I need Angular.js and why he</a></li>
<li><a href="https://codemotion.ninja/blog/development/modern-tools-framework-angular-js-frontend-applications">Modern tools and framework Angular.js frontend applications</a></li>
<li><a href="https://codemotion.ninja/blog/development/familiarity-controllers-directives-angular-js">Familiarity with controllers and directives Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/writing-services-angular-js">Writing Services in Angular.js</a></li>
<li>Routing in Angular.js</li>
<li><a href="https://codemotion.ninja/blog/development/connect-api-backend-angular-js">How to connect to the API backend Angular.js</a></li>
</ol>
<p>We are approaching the end of our guidance for Angular.js. There are only two articles: and this is another. In this we consider the <a href="https://github.com/angular-ui/ui-router" target="_blank" rel="nofollow noopener">Angular.js UI Router</a> &#8211; a library to organize navigation between different parts of our application. At the same time, we can rewrite our code so that it uses the templates, instead of storing the entire html to a single file.</p>
<p>Templates in our application are stored in <code>src/app/app_part/</code>. Under <code>app_part</code> I mean a separate part of the application. Now we only <code>main</code>, but in the future may be in the same sub-folder <code>settings</code>, <code>categories</code> and everything else. Fast forward the entire central portion containing the form to add transactions and table with transactions in <a href="https://github.com/mkdev-me/ng.mkdev/blob/master/src/app/main/transactions.html" target="_blank" rel="noopener">src/app/main/transactions.html</a> and replace it with:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;div class="col-xs-6" ui-view&gt;&lt;/div&gt;</pre>
<p>It is also necessary to remove the ui-view from above of the container level. Thus, in <code>src/index.html</code> inside the body tag in addition to the script tags we still have the following layout:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;div class="container"&gt;
  &lt;div class="col-xs-2" ng-controller="NavigationCtrl as navigation_ctrl"&gt;
    &lt;h2&gt;Money&lt;/h2&gt;
    &lt;h3 class="money-ok"&gt;
      {{navigation_ctrl.transactions_store.sum()}}
    &lt;/h3&gt;
    &lt;ul class="nav nav-pills nav-stacked"&gt;
      &lt;li&gt;
        &lt;a&gt;
          &lt;i class="glyphicon glyphicon-th-list"&gt;&lt;/i&gt;
          Transactions &lt;span class="badge"&gt;{{navigation_ctrl.transctions_store.transactions.length}}&lt;/span&gt;
        &lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a&gt;
          &lt;i class="glyphicon glyphicon-tasks"&gt;&lt;/i&gt; Settings
        &lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class="col-xs-6" ui-view&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>Now we have nothing works, because we did not specify what kind of UI Router&#8217;u template output in ui-view at the root link. That&#8217;s what this library and deals with: inserts ui-view template corresponding to the application settings.</p>
<p>So, we update <code>src/app/index.js</code> :</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">'use strict';
angular.module('ngmkdev', ['restangular', 'ui.router'])
  .config(function ($stateProvider, $urlRouterProvider) {
    $stateProvider
    .state('transactions', {
      url: "/",
      templateUrl: "app/main/transactions.html"
    });
    $urlRouterProvider.otherwise('/');
  });</pre>
<p>We use the function of <code>config()</code> to configure the various <a href="https://docs.angularjs.org/guide/providers" target="_blank" rel="nofollow noopener">service providers</a> (one of the types of services), before they begin to be used in other parts of the application.</p>
<p>Here, through a chain of calls to the function <code>state()</code> on the service <code>$stateProvider</code> we specify which template to display inside the ui-view for each page. The last line, <code>$urlRouterProvider.otherwise('/');</code> said Angular&#8217;u what address to redirect the user if the requested route does not exist. Our app now again should work as before.</p>
<p><i>Few analogies for those familiar with Ruby on Rails: ui-view can be compared with the yield in rail templates and call chain <code>state()</code> &#8211; a file routes.rb.</i></p>
<p>Let&#8217;s try to add a real navigation: to link transactions led to the table with the transactions, and settings for future user settings page.</p>
<p>We update our list of routes:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">'use strict';
angular.module('ngmkdev', ['restangular', 'ui.router'])
  .config(function ($stateProvider, $urlRouterProvider) {

    $stateProvider
    .state('transactions', {
      url: "/transactions",
      templateUrl: "app/main/transactions.html"
    })
    .state('settings', {
      url: "/settings",
      templateUrl: "app/settings/settings.html"
    })

    $urlRouterProvider.otherwise('/transactions');
  });</pre>
<p>And add the file <code>app/settings/settings.html</code> with such content:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;h2&gt;Settings&lt;/h2&gt;</pre>
<p>Now, any nonexistent path will be redirected to the page with the transaction. Try to open the following path: <code>http://localhost:3000/</code>, <code>http://localhost:3000/#/transactions</code>, <code>http://localhost:3000/#/settings</code>, <code>http://localhost:3000/#/crap</code>.</p>
<p>Sense from the manual driving bit addresses, so revive links in the sidebar. To this end, there is UI Router directive <code>ui-sref</code>, stating the name of the State (the first argument to the function state ()), which is due to open by clicking on the following link:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;li&gt;
  &lt;a ui-sref="transactions"&gt;
    &lt;i class="glyphicon glyphicon-th-list"&gt;&lt;/i&gt;
    Transactions &lt;span class="badge"&gt;{{navigation_ctrl.transctions_store.transactions.length}}&lt;/span&gt;
  &lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
  &lt;a ui-sref="settings"&gt;
    &lt;i class="glyphicon glyphicon-tasks"&gt;&lt;/i&gt; Settings
  &lt;/a&gt;
&lt;/li&gt;</pre>
<p>That&#8217;s enough to our menu earned &#8211; by clicking on the links the central part of the application changes. Commit to the changes done in the article: <a href="https://github.com/mkdev-me/ng.mkdev/commit/448daee54a90c20c9b888008afcd92b20a56a887" target="_blank" rel="nofollow noopener">448daee</a>.</p>
<p>Homework:</p>
<ul>
<li>Refer to the documentation UI Router way to highlight the current menu item</li>
</ul>
<p>The post <a rel="nofollow" href="https://codemotion.us/routing-angular-js/">Routing in Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
	</item>
		<item>
		<title>Familiarity with controllers and directives Angular.js</title>
		<link>https://codemotion.us/familiarity-controllers-directives-angular-js/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Mon, 31 Oct 2016 15:02:13 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5067</guid>

					<description><![CDATA[<p>Series &#8220;Developing applications on single-Angular.js&#8221; Why do I need Angular.js and why he Modern tools and framework Angular.js frontend applications Familiarity with controllers and directives Angular.js Writing Services in Angular.js Routing in Angular.js How to connect to the API backend Angular.js In this article we will write a simple controller Angular.js and make it display [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/familiarity-controllers-directives-angular-js/">Familiarity with controllers and directives Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Series &#8220;Developing applications on single-Angular.js&#8221;</h2>
<ol>
<li><a href="https://codemotion.ninja/blog/development/why-do-i-need-angular-js">Why do I need Angular.js and why he</a></li>
<li><a href="https://codemotion.ninja/blog/development/modern-tools-framework-angular-js-frontend-applications">Modern tools and framework Angular.js frontend applications</a></li>
<li>Familiarity with controllers and directives Angular.js</li>
<li><a href="https://codemotion.ninja/blog/development/writing-services-angular-js">Writing Services in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/routing-angular-js">Routing in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/connect-api-backend-angular-js">How to connect to the API backend Angular.js</a></li>
</ol>
<p>In this article we will write a simple controller Angular.js and make it display the data in this table using the built-in Angular directives. Moreover, we revive this form so that it really adds a new row to the table transactions.</p>
<p>Controllers Angular.js are the link between the html-marking and a &#8220;model&#8221;. The Angular model responsible for just 4 different kinds of objects, which we will discuss later. Omit is that the model and will store all of the data directly in the controller.</p>
<p>The task of the controller, as well as in other MVC frameworks, is to obtain data from the model and display it to the user, or in the other direction, to obtain data from the view and sending them to the model.</p>
<p>First of all, remove <code>src/app/main.controller.js</code>, <code>src/app/main.controller.spec.js</code>, <code>src/app/main.html</code> and <code>src/components/navbar/</code>, which generated the Yeoman for us.</p>
<h4>Writing the first controller</h4>
<p>Our first controller will be called <code>TransactionsCtrl</code>. According to the naming conventions in Angular.js, controller name is constructed as a &#8220;name + Ctrl&#8221;.</p>
<p>Create a file <code>src/app/main/transactions.controller.js</code>. In this file, define the controller itself:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">//src/app/main/transactions.controller.js
 angular. module ( "ngmkdev") . controller ( 'TransactionsCtrl', function ($ scope) {

 });</pre>
<p>Note that we do not need to connect the newly created file manually using the tag <code>&lt;script&gt;</code>. When we run <code>gulp serve</code>, Gulp will begin to monitor changes to files and folders and update the temporary <code>index.html</code> inside the folder <code>.tmp/</code> (he, by the way, and is loaded when you open the browser <code>localhost:4567</code>). And when it comes time to collect the final version of the application, the command gulp build will do the same and return to us the necessary <code>index.html</code> with pressed down or attached files, necessary libraries and applications.</p>
<p>At this stage, we will not break layout application into multiple files and directly edit src/index.html (and so we removed the folder components/navbar/ and main.html ).</p>
<p>The index.html file replace <code>&lt;div ui-view&gt;&lt;/div&gt;</code> on the following simple layout:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;
&lt;div ui-view class="container"&gt;
  &lt;div class="col-xs-2"&gt;
    &lt;h2&gt;Money&lt;/h2&gt;
    &lt;h3 class="money-ok"&gt;
      500.0
    &lt;/h3&gt;
    &lt;ul class="nav nav-pills nav-stacked"&gt;
      &lt;li&gt;
        &lt;a href="#"&gt;&lt;i class="glyphicon glyphicon-th-list"&gt;&lt;/i&gt; Transations&lt;/a&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;a href="#"&gt;&lt;i class="glyphicon glyphicon-tasks"&gt;&lt;/i&gt; Settings&lt;/a&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/div&gt;
  &lt;div class="col-xs-6"&gt;
    &lt;h2&gt;Transations&lt;/h2&gt;

    &lt;br&gt;
  &lt;/div&gt;
&lt;/div&gt;</pre>
<p>Note: we have not spent a single second on the manual connection Boostrap, but soon moved to its use. Many developing routine processes are automated: we only need to impose himself layout. On connecting the files will take care Gulp, and of a beautiful appearance &#8211; Bootstrap.</p>
<p>Now you need to determine the controller on some the html-element in our application to have access to the controller inside and we could use the data from the controller inside the html.</p>
<p>It is best suited for this central unit with the transaction. Define the controller on the parent unit using directives <code>ng-controller</code>:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;
&lt;div class="col-xs-6" ng-controller="TransactionsCtrl as transactions_ctrl"&gt;
   &lt;h2&gt;Transations&lt;/h2&gt;
   &lt;br&gt;
&lt;/div&gt;</pre>
<p>Directive Angular.js responsible for adding new functionality html-markup. This directive goes through the connection of your js-code interface. <code>ng-controller</code> &#8211; one of the simplest and most important directives. She attributes part of html code to a particular controller, makes available <code>$scope</code> of this controller inside the html element.</p>
<h4>What is the $scope?</h4>
<p><code>$scope</code> &#8211; is an object, through which we can get in the html code of access to the data from the model and controller. In Angular.js implemented a complex system upgrade and inheritance Scope. The most important is the <code>$rootScope</code>, which is defined on the entire application and accessible from any part of the code. Controllers provide a <code>$scope</code>, which is available in html-element on which this controller is defined.</p>
<p>Starting with version 1.2, in Angular.js a new syntax for accessing the controller from html: specifying <code>as transactions_ctrl</code> to <code>$scope</code> of this element defines a new object corresponding to the controller. All that we define in <code>TransactionsCtrl</code> controller through <code>this</code> will be available through <code>transactions_ctrl</code>. Thus solving the problem of nested <code>$scope</code> &#8211; we always know exactly how to Scope we work.</p>
<p>Let&#8217;s see this behavior as an example. Define attribute transactions for the controller as follows:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">//src/app/main/transactions.controller.js
angular.module('ngmkdev').controller('TransactionsCtrl', function($scope) {
  this.transactions = [
    { amount: 500.00, date: "08/08/2014", description: "Subscribe to the magazine" },
    { amount: 150.00, date: "07/08/2015", description: "Cocaine" }
  ]
});</pre>
<p>And I will bring the transaction using another directive &#8211; <code>ng-repeat</code>, responsible for the removal of the collections. Its syntax is self-explanatory.</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;
&lt;div class="col-xs-6" ng-controller="TransactionsCtrl as transactions_ctrl"&gt;
  &lt;h2&gt;Transactions&lt;/h2&gt;
  &lt;br&gt;
  &lt;table class="table table-striped"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th&gt;Sum&lt;/th&gt;
        &lt;th&gt;Date&lt;/th&gt;
        &lt;th&gt;Descriptions&lt;/th&gt;
        &lt;th&gt;Actions&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
      &lt;tr ng-repeat="transaction in transactions_ctrl.transactions"&gt;
        &lt;td&gt;{{transaction.amount}}&lt;/td&gt;
        &lt;td&gt;{{transaction.date}}&lt;/td&gt;
        &lt;td&gt;{{transaction.description}}&lt;/td&gt;
        &lt;td&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
&lt;/div&gt;</pre>
<p>To print something from the controller to the screen the user uses braces. Angular.js uses existing template engines like <a href="http://handlebarsjs.com/" target="_blank" rel="nofollow noopener">Handlebars</a> or <a href="https://mustache.github.io/" target="_blank" rel="nofollow noopener">Mustache</a>. Instead, the framework is built right into your template.</p>
<p>But of course we need &#8211; we need a way to add new transactions. To do this, we mark up a simple form, paste it immediately after the header <code>&lt;h2&gt;Transactions&lt;/h2&gt;</code>:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;
&lt;form class="form-inline"&gt;
  &lt;div class="form-group"&gt;
    &lt;div class="input-group"&gt;
      &lt;div class="input-group-addon"&gt;$&lt;/div&gt;
      &lt;input class="form-control" type="text" placeholder="Amount"&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class="form-group"&gt;
    &lt;label class="sr-only"&gt;&lt;/label&gt;
    &lt;input type="text" class="form-control" placeholder="Description"&gt;
  &lt;/div&gt;
  &lt;button type="submit" class="btn btn-default"&gt;Add&lt;/button&gt;
&lt;/form&gt;</pre>
<p>Add a template for a new transaction to the controller:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/main/transactions.controller.js

// ...
  this.resetTransaction = function() {
    this.newTransaction = {
      amount: 0.0,
      date: "01/02/1993",
      description: null
    }
  }
  this.resetTransaction();
// …</pre>
<p>The current transaction will be equal to the workpiece from the function immediately after initialization controller <code>resetTransaction()</code>.</p>
<p>Now you need to associate the shape of the object newTransaction . To do this, we will use the directive <code>ng-model</code>, which links form element with any controller attribute. Altered INPUT take the form:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;
&lt;!-- ... --&gt;
&lt;input class="form-control"
       type="text"
       placeholder="Amount"
       ng-model="transactions_ctrl.newTransaction.amount"&gt;
&lt;!-- ... --&gt;
&lt;input type="text"
       class="form-control"
       placeholder="Description"
       ng-model="transactions_ctrl.newTransaction.description"&gt;
&lt;!-- ... --&gt;</pre>
<p>It remains now add form submission process. Fortunately, this has a built-in Angular.js directive <code>ng-submit</code>. Form takes the form:</p>
<pre class="prettyprint lang-html" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">&lt;!-- src/index.html --&gt;
&lt;form class="form-inline" ng-submit="transactions_ctrl.addTransaction()"&gt;
&lt;!-- ... --&gt;
&lt;/form&gt;</pre>
<p>Add a method <code>addTransaction()</code> in <code>TransactionsCtrl</code> :</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/main/transactions.controller.js
// ...
this.addTransaction = function() {
  this.transactions.push(this.newTransaction);
  this.resetTransaction();
}
// ...</pre>
<p>&nbsp;</p>
<p>All is ready! Open the browser, fill in the form below, or Hit Enter-button on the form and our table is automatically updated: a new transaction appears at the bottom of the table. Note: we have not written the code that updates a table. Angular.js he understands that when the array of transactions need to be updated corresponding to the array of the html-code. This is one of the coolest features Angular.js &#8211; automatic updates and two-way communication between the html-code and application code.</p>
<p>Now, dear reader is invited to move from reading the tutorial to a particular practice. Here are some tasks that you can solve on their own within this sample application:</p>
<ol>
<li>Get rid of these transactions directly in the code.</li>
<li>Sort Descending transaction Transaction date &#8211; the most recent on top than below the old one.</li>
</ol>
<p>Forknite <a href="https://github.com/mkdev-me/ng.mkdev" target="_blank" rel="nofollow noopener">repository with an application</a> and implement these tasks. All the code in this article is to commit <a href="https://github.com/mkdev-me/ng.mkdev/commit/12aacf62a4b8ffb6503201ac62d74b7bb8adce81" target="_blank" rel="nofollow noopener">12aacf6</a> In the next article we will learn how to use the service objects and learn about dependency injection in Angular.js.</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/familiarity-controllers-directives-angular-js/">Familiarity with controllers and directives Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
	</item>
		<item>
		<title>Modern tools and framework Angular.js frontend applications</title>
		<link>https://codemotion.us/modern-tools-framework-angular-js-frontend-applications/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Mon, 31 Oct 2016 10:56:48 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5035</guid>

					<description><![CDATA[<p>Series &#8220;Developing applications on single-Angular.js&#8221; Why do I need Angular.js and why he Modern tools and framework Angular.js frontend applications Familiarity with controllers and directives Angular.js Writing Services in Angular.js Routing in Angular.js How to connect to the API backend Angular.js In this article, we will configure the operating environment necessary for productive work with [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/modern-tools-framework-angular-js-frontend-applications/">Modern tools and framework Angular.js frontend applications</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Series &#8220;Developing applications on single-Angular.js&#8221;</h2>
<ol>
<li><a href="https://codemotion.ninja/blog/development/why-do-i-need-angular-js">Why do I need Angular.js and why he</a></li>
<li>Modern tools and framework Angular.js frontend applications</li>
<li><a href="https://codemotion.ninja/blog/development/familiarity-controllers-directives-angular-js">Familiarity with controllers and directives Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/writing-services-angular-js">Writing Services in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/routing-angular-js">Routing in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/connect-api-backend-angular-js">How to connect to the API backend Angular.js</a></li>
</ol>
<p>In this article, we will configure the operating environment necessary for productive work with Angular.js. But before moving on to the review of the tools we need, let&#8217;s look at a naive solution to the problem of files and folders in the frontend application.</p>
<p>In the picture we can see the structure of the application in which all javascript files are stored in the same folder, without any division into logical components. In index.html &#8211; connecting these files bunch of tags <code>&lt;script&gt;</code>. Not get away with this approach: the files will be more and support such an application would be many times more difficult. Other developers in the project will be confused, they have each time to understand that where and how.</p>
<p><img fetchpriority="high" decoding="async" width="866" height="418" class="alignnone size-medium wp-image-5038" src="https://codemotion.ninja/wp-content/uploads/2016/10/angular-post-2-img-1.jpg" alt="angular-post-2-img-1" srcset="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-1.jpg 866w, https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-1-300x145.jpg 300w, https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-1-768x371.jpg 768w" sizes="(max-width: 866px) 100vw, 866px" /></p>
<p>This is a problem faced by many front-end developers, and as a result wrote various insturmenty to facilitate the development process.</p>
<h4>Tools for frontend development</h4>
<p>The first of them &#8211; <a href="http://yeoman.io/" target="_blank" rel="nofollow noopener">Yeoman</a>. This is a program to generate code similar to the generators of the Ruby on Rails. Generators allow using simple commands in the console to create a new application with a specific directory structure, eliminating the need to do it manually and make it easier to follow the standards in the organization of the code. For Yeoman written many generators, including Angular.js applications ember.js applications simple applications using jQuery, etc.</p>
<p>The second tool &#8211; <a href="http://gulpjs.com/" target="_blank" rel="nofollow noopener">Gulp.js</a>. It can be compared with <a href="https://github.com/ruby/rake" target="_blank" rel="nofollow noopener">Rake</a> from Ruby world: Gulpen allows to describe the various tasks that must be performed during development: for example, the compilation of the final css and js files or automatically update the browser page after changes to these files, which saves time developer.</p>
<p>In Angular.js already built modules support, so we do not need to use tools such as <a href="http://browserify.org/" target="_blank" rel="nofollow noopener">Browserify</a> or <a href="http://requirejs.org/" target="_blank" rel="nofollow noopener">require.js</a> to manage dependencies between modules.</p>
<p>To install the Yeoman and Gulp.js we need <a href="https://www.npmjs.com/" target="_blank" rel="nofollow noopener">npm</a>. npm &#8211; is a package manager for <a href="https://nodejs.org/" target="_blank" rel="nofollow noopener">node.js</a>, which, in turn, is the engine for writing server-side javascript applications. We will use npm to install all of our dependencies in the design.</p>
<p>More we need <a href="http://bower.io/" target="_blank" rel="nofollow noopener">Bower</a> , another package manager on Twitter. Bower is designed for installation dependencies needed in the front. For example, various jQuery plugins or Angular.js library. The advantage of using Bower for these dependencies is that Bower does not download attachments based, so each library will be installed only once. It is very important for the end user &#8211; no one wants to download five versions of jQuery.</p>
<p><img decoding="async" width="835" height="278" class="alignnone size-medium wp-image-5042" src="https://codemotion.ninja/wp-content/uploads/2016/10/angular-post-2-img-2.jpg" alt="angular-post-2-img-2" srcset="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-2.jpg 835w, https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-2-300x100.jpg 300w, https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-2-768x256.jpg 768w" sizes="(max-width: 835px) 100vw, 835px" /></p>
<h4>Generation Angular.js applications</h4>
<p>Let&#8217;s start with installing node.js and npm. If you have a Mac, you can do this by running <code>brew install node</code>. If you Ubuntu, you can install the package by using <code>apt-get install node</code>. For all installation methods, check the official website of node.js &#8211; <a href="http://nodejs.org/" target="_blank" rel="nofollow noopener">http://nodejs.org/</a>.</p>
<p>With node.js established and npm, which means we can go directly to the installation Yeoman, Gulp and Bower. This is done in the command <code>npm install yo bower gulp -g</code>. Option <code>-g</code> installs as a global package. This allows the use of command utilities for any directory on your system. Otherwise, the relationship will be downloaded in the current folder in a subfolder <code>node_modules</code>. If an error appears that Gulp is not found in the project folder, try the <code>npm link gulp</code>.</p>
<p>Now we need to install the generator to Yeoman. Instead, the official Angular.js generator we use a <a href="https://github.com/Swiip/generator-gulp-angular" target="_blank" rel="nofollow noopener">copy of it</a>, which is used Gulp. An alternative could be Gulp <a href="http://gruntjs.com/" target="_blank" rel="noopener">Grunt.js</a>. Grunt.js similar to Gulp, but slower because of the fact that it does not use node.js. flows It is also more difficult to use.</p>
<p>Perform <code>npm install -g generator-gulp-angular</code>, and thus ends the installation of the first set of a package we want.</p>
<p>Go to the application generation. Create a new folder ngmkdev and it will fulfill <code>yo gulp-angular</code>. Generator prompts us to specify the individual parameters of our application:</p>
<ol>
<li>Select the latest version of Angular.js.</li>
<li>Of the additional modules Angular.js we do not need, so skip the selection of angular-animate, angular-cookies, angular-touch and angular-sanitize.</li>
<li>Choosing jQuery 2.x. In Angular.js already built a lightweight version of jQuery &#8211; jqLite. But we may need more advanced jQuery features, so connect a full library.</li>
<li>Since we plan to work with JSON API, then we need a library for easy handling. Of the two options is most popular in the community and has more features <a href="https://github.com/mgonto/restangular" target="_blank" rel="nofollow noopener">Restangular</a> , why dwell on it.</li>
<li>For the same reasons we choose <a href="https://github.com/angular-ui/ui-router" target="_blank" rel="nofollow noopener">UI Router</a> instead of the official of the router.</li>
<li>To write your own interface, we will use <a href="http://getbootstrap.com/" target="_blank" rel="nofollow noopener">Twitter boostrap</a>. This will speed up the time for typesetting and make our application a little more beautiful.</li>
<li>Once selected Bootstrap, the future will choose the next step Angular UI Bootstrap</li>
<li>We choose the good old css at the moment.</li>
<li>Just do without CoffeeScript (we love it, but then you do not know it yet?)</li>
<li>We will use standard HTML.</li>
</ol>
<p>Note: we did not connect <a href="http://sass-lang.com/" target="_blank" rel="nofollow noopener">SASS</a> and <a href="http://coffeescript.org/" target="_blank" rel="nofollow noopener">CoffeeScript</a> exclusively to pereslozhnyat not material for newcomers to modern front-end development. If you are familiar with these tools, it is recommended that they also use within the project.</p>
<h4>Analysis of the structure of the application Angular.js</h4>
<p>On generation will leave for some time, after which we get a framework for our application. Let&#8217;s see what we have to generate.</p>
<p><b>package.json</b></p>
<p>File <code>package.json</code> contains various metadata about your project: project name, version, description.</p>
<p><code>dependencies</code> &#8211; that is an empty list of project dependencies.</p>
<p><code>devDependencies</code> &#8211; it&#8217;s dependencies required for application development. Not the fact that we will use all of the dependencies that it has generated Yeoman, but some of them are definitely useful and unnecessary can be removed afterwards.</p>
<p><code>engines</code> &#8211; indicates node.js version, we (implicitly) will use.</p>
<pre class="prettyprint lang-json" data-start-line="1" data-visibility="visible" data-highlight="4,5,41" data-caption="">{
   "Name": "ngmkdev",
   "Version": "0.0.0",
   "Dependencies": {},
   "DevDependencies": {
     "Gulp": "~ 3.8.10",
     "Gulp-autoprefixer": "~ 2.0.0",
     "Gulp-angular-templatecache": "~ 1.4.2",
     "Del": "~ 0.1.3",
     "Gulp-consolidate": "~ 0.1.2",
     "Gulp-csso": "~ 0.2.9",
     "Gulp-filter": "~ 1.0.2",
     "Gulp-flatten": "~ 0.0.4",
     "Gulp-jshint": "~ 1.9.0",
     "Gulp-load-plugins": "~ 0.7.1",
     "Gulp-size": "~ 1.1.0",
     "Gulp-uglify": "~ 1.0.1",
     "Gulp-useref": "~ 1.0.2",
     "Gulp-ng-annotate": "~ 0.3.6",
     "Gulp-replace": "~ 0.5.0",
     "Gulp-rename": "~ 1.2.0",
     "Gulp-rev": "~ 2.0.1",
     "Gulp-rev-replace": "~ 0.3.1",
     "Gulp-minify-html": "~ 0.1.7",
     "Gulp-inject": "~ 1.0.2",
     "Gulp-protractor": "~ 0.0.11",
     "Gulp-karma": "~ 0.0.4",
     "Gulp-angular-filesort": "~ 1.0.4",
     "Main-bower-files": "~ 2.4.0",
     "Jshint-stylish": "~ 1.0.0",
     "Wiredep": "~ 2.2.0",
     "Karma-jasmine": "~ 0.3.1",
     "Karma-phantomjs-launcher": "~ 0.1.4",
     "Require-dir": "~ 0.1.0",
     "Browser-sync": "~ 1.7.1",
     "Http-proxy": "~ 1.7.0",
     "Chalk": "~ 0.5.1",
     "Protractor": "~ 1.4.0",
     "Uglify-save-license": "~ 0.4.1"
   }
   "Engines": {
     "Node": "&gt; = 0.10.0"
   }
 }</pre>
<p>&nbsp;</p>
<p><b>bower.json</b></p>
<p>In <code>bower.json</code> stored dependencies for the end user. As mentioned earlier, Bower does not download attachments, depending which makes it ideal for front-end dependencies of your application. Here we see, for example, as defined above jQuery, Twitter Boostrap, Restangular.</p>
<pre class="prettyprint lang-json" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">{
  "name": "ngmkdev",
  "version": "0.0.0",
  "dependencies": {
    "jquery": "~2.1.1",
    "restangular": "~1.4.0",
    "angular-ui-router": "~0.2.13",
    "bootstrap": "~3.3.1",
    "angular-bootstrap": "0.12.x",
    "angular": "~1.3.4"
  },
  "devDependencies": {
    "angular-mocks": "~1.3.4"
  },
  "resolutions": {
    "jquery": "~2.1.1",
    "angular": "~1.3.4"
  }
}</pre>
<p>&nbsp;</p>
<p><b>gulpfile.js</b></p>
<p><code>gulpfile.js</code> only connects all the files from the folder <code>gulp/</code>. This folder contains the various tasks performed Gulp.js. For example, <code>gulp/build.js</code> collects the final application ready for use in prodakshene. We will not delve into the gulp-syntax problems, we consider it as something other time.</p>
<p><b>node_modules and bower_components</b></p>
<p>In <code>node_modules/</code> npm downloads all the dependencies of package.json. In <code>bower_components/</code> downloaded all the dependencies of bower.json.</p>
<p><b>karma.conf.js</b></p>
<p>It contains the configuration of karma &#8211; test framework Angular.js. It we also look at some other time. As to the test environment includes a folder <code>e2e/</code> (end-to-end) and <code>protractor.conf.js</code>.</p>
<hr />
<p>For all other folders, which we shall consider in the following articles, contains the application itself, and tests it.</p>
<p>Now let&#8217;s run our application and see how it looks in a browser. To do this, we need to execute the command <code>gulp serve</code> (what makes this team can be found in the file <code>gulp/server.js</code> near 34th line). Upon execution, the application automatically opens in a browser. In development mode, it will spin at <code>localhost:3000</code>.</p>
<p>Note: this also launch live reload. If you add something to the index.html, then after saving Gulp file in the browser reloads the page for us.</p>
<p>So, we have generated a framework for our project, reviewed the main application files and folders, and run it. In the next article we will start to write the application. Full application code developed within this series, is available in the GitHub: <a href="https://github.com/mkdev-me/ng.mkdev" target="_blank" rel="nofollow noopener">https://github.com/mkdev-me/ng.mkdev</a>. Each article is devoted to a separate commit to the repository.</p>
<h4>Further reading</h4>
<ul>
<li><a href="https://docs.google.com/document/d/1XXMvReO8-Awi1EZXAXS4PzDzdNvV6pGcuaF4Q9821Es/pub" target="_blank" rel="nofollow noopener">Best Practice Recommendations for Angular App Structure</a></li>
<li><a href="https://github.com/Swiip/generator-gulp-angular" target="_blank" rel="nofollow noopener">github.com/Swiip/generator-gulp-angular</a></li>
</ul>
<p>The post <a rel="nofollow" href="https://codemotion.us/modern-tools-framework-angular-js-frontend-applications/">Modern tools and framework Angular.js frontend applications</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
		<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-1-150x150.jpg" />
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-1.jpg" medium="image">
			<media:title type="html">angular-post-2-img-1</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-1-150x150.jpg" />
		</media:content>
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-2.jpg" medium="image">
			<media:title type="html">angular-post-2-img-2</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-2-img-2-150x150.jpg" />
		</media:content>
	</item>
		<item>
		<title>Why do I need Angular.js and why he</title>
		<link>https://codemotion.us/why-do-i-need-angular-js/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Mon, 31 Oct 2016 09:53:56 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5015</guid>

					<description><![CDATA[<p>Series &#8220;Developing applications on single-Angular.js&#8221; Why do I need Angular.js and why he Modern tools and framework Angular.js frontend applications Familiarity with controllers and directives Angular.js Writing Services in Angular.js Routing in Angular.js How to connect to the API backend Angular.js Why do I need Angular.js and why he At some point, you decide to [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/why-do-i-need-angular-js/">Why do I need Angular.js and why he</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Series &#8220;Developing applications on single-Angular.js&#8221;</h2>
<ol>
<li>Why do I need Angular.js and why he</li>
<li><a href="https://codemotion.ninja/blog/development/modern-tools-framework-angular-js-frontend-applications">Modern tools and framework Angular.js frontend applications</a></li>
<li><a href="https://codemotion.ninja/blog/development/familiarity-controllers-directives-angular-js">Familiarity with controllers and directives Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/writing-services-angular-js">Writing Services in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/routing-angular-js">Routing in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/connect-api-backend-angular-js">How to connect to the API backend Angular.js</a></li>
</ol>
<h2>Why do I need Angular.js and why he</h2>
<p>At some point, you decide to write a web application in which everything runs on AJAX call, the page never reloads, and the interface resembles a full-fledged desktop application rather than a traditional website. You try to do everything with a simple JavaScript and jQuery plugins couple of dozen, and quickly written code will be impossible to maintain, it is impossible to read and impossible to govern.</p>
<p>To avoid such a catastrophic situation, you need a tool that provides a rigid structure of the code and agreement on writing applications, as well as turnkey solutions for known issues (for example, for two-way communication variable in the code and text on the page that displays the value of this variable). This tool &#8211; JavaScript MVC (MVC or analogs) frameworks.</p>
<p>There is a high probability that you will not need to use the JS frameworks coming months and \ or years. The area of application is quite specific: the so-called one-page application (Single Page Applications, SPA). Typical examples: Google Drive, Gmail, Evernote. But even in those cases when the task is to write a one-page application that does not always make sense to use a full-fledged JavaScript framework: it all depends on how dynamic and complex UI you are trying to build.</p>
<p>Web version of Evernote &#8211; SPA typical application</p>
<p><img decoding="async" width="328" height="170" class="alignnone size-medium wp-image-5025" src="https://codemotion.ninja/wp-content/uploads/2016/10/angular-post-1-img-1.jpg" alt="angular-post-1-img-1" srcset="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-1.jpg 328w, https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-1-300x155.jpg 300w" sizes="(max-width: 328px) 100vw, 328px" /></p>
<p>Nevertheless, the popularity of such tools has never been greater, and at least be aware of their existence is. Tell all available varintah at a time is not possible, so in this series of articles we will look at a framework Angular.js. If you are interested in alternative solutions, you can watch them online <a href="http://todomvc.com/" target="_blank" rel="nofollow noopener">http://todomvc.com/</a> &#8211; the authors of the draft implementing the same application on different frameworks, to make it easier for developers to choose the most suitable for them.</p>
<h4>Why Angular.js?</h4>
<p>From my point of view, Angular.js became a stunning combination of a low entry threshold and a rich set of functions. To start writing on it a small application, you will need about an hour of free time. In this case the fact to learn and to use all its features, will need months. While there was not a single front end problems I could not solve with the help of this framework. And I used it for cross-platform mobile applications with rich functionality, small widgets within applications and even video editor.</p>
<p>Angular.js at the moment is the most popular framework, whose development is supported by the guys from Google. In addition to the rich standard library, for &#8220;angulyara&#8221; written many custom extensions, with a part of which we will introduce within this series. There is even a special framework over Angular.js, which greatly facilitates writing cross-platform mobile applications: <a href="http://ionicframework.com" target="_blank" rel="nofollow noopener">http://ionicframework.com</a></p>
<p><img loading="lazy" decoding="async" width="695" height="185" class="alignnone size-medium wp-image-5031" src="https://codemotion.ninja/wp-content/uploads/2016/10/angular-post-1-img-2.png" alt="angular-post-1-img-2" srcset="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-2.png 695w, https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-2-300x80.png 300w" sizes="(max-width: 695px) 100vw, 695px" /></p>
<h4>What about Angular.js 2.0?</h4>
<p>The current version Angular.js, where this series of articles will be based &#8211; 1.3. The developers have stated that the version 2.0, which will be released when it is not known (but no earlier than year and a half), is incompatible with the current version of the framework, but it will retain most of the concepts embodied in it. Also, the developers promise to support the version 1.x for several years after the release of 2.0.</p>
<p>This means that at least another 2 years Angular.js 1.x will continue to dominate on it is still written thousands of applications and a variety of jobs (especially in Europe) indicate precisely the frameworks in the requirements. Of course, at some point you will have to spend a couple of hours trying to deal with the new version 2.0 and, most likely, a couple of days to switch from 1.x to 2.0. Nevertheless, Angular.js knowledge will not be thrown in the trash, because, as you already know, this issue is not a specific technology, and the ability to understand any of them, and apply for its task <img src="https://s.w.org/images/core/emoji/17.0.2/72x72/1f609.png" alt="😉" class="wp-smiley" style="height: 1em; max-height: 1em;" /></p>
<p>The announcement of version 2.0 can be read here: <a href="http://angularjs.blogspot.se/2014/10/ng-europe-angular-13-and-beyond.html" target="_blank" rel="nofollow noopener">http://angularjs.blogspot.se/2014/10/ng-europe-angular-13-and-beyond.html</a>. More good article with more technical details: <a href="http://ng-learn.org/2014/03/AngularJS-2-Status-Preview/" target="_blank" rel="nofollow noopener">http://ng-learn.org/2014/03/AngularJS-2-Status-Preview/</a></p>
<h4>So what are we going to do?</h4>
<p>In this series of articles we will write a small finance manager: start with the work environment configuration and structure of the project and will finish the work with the API. On the way to get acquainted with the basic concepts Angular.js, routing, some third-party libraries, and a few essential tools of modern front-end development. At the end of the series, you should be able to write a simple application to Angular.js and know where to look in order to learn how to develop more complicated things.</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/why-do-i-need-angular-js/">Why do I need Angular.js and why he</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
		<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-1-150x150.jpg" />
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-1.jpg" medium="image">
			<media:title type="html">angular-post-1-img-1</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-1-150x150.jpg" />
		</media:content>
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-2.png" medium="image">
			<media:title type="html">angular-post-1-img-2</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/angular-post-1-img-2-150x150.png" />
		</media:content>
	</item>
		<item>
		<title>How to connect to the API backend Angular.js</title>
		<link>https://codemotion.us/connect-api-backend-angular-js/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Wed, 26 Oct 2016 16:05:31 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Angular]]></category>
		<category><![CDATA[angularjs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5094</guid>

					<description><![CDATA[<p>Series &#8220;Developing applications on single-Angular.js&#8221; Why do I need Angular.js and why he Modern tools and framework Angular.js frontend applications Familiarity with controllers and directives Angular.js Writing Services in Angular.js Routing in Angular.js How to connect to the API backend Angular.js In this article we will learn how to connect our application with a simple [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/connect-api-backend-angular-js/">How to connect to the API backend Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Series &#8220;Developing applications on single-Angular.js&#8221;</h2>
<ol>
<li><a href="https://codemotion.ninja/blog/development/why-do-i-need-angular-js">Why do I need Angular.js and why he</a></li>
<li><a href="https://codemotion.ninja/blog/development/modern-tools-framework-angular-js-frontend-applications">Modern tools and framework Angular.js frontend applications</a></li>
<li><a href="https://codemotion.ninja/blog/development/familiarity-controllers-directives-angular-js">Familiarity with controllers and directives Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/writing-services-angular-js">Writing Services in Angular.js</a></li>
<li><a href="https://codemotion.ninja/blog/development/routing-angular-js">Routing in Angular.js</a></li>
<li>How to connect to the API backend Angular.js</li>
</ol>
<p>In this article we will learn how to connect our application with a simple API using Restangular library. Restangular &#8211; a popular alternative to the built-in self Angular.js library for working with REST API. On its advantages over the standard library are well described on the project&#8217;s page at github: <a href="https://github.com/mgonto/restangular" target="_blank" rel="nofollow noopener">https://github.com/mgonto/restangular</a>. For example, it supports all the HTTP methods and devoid of various nasty bugs embedded in Angular.js library.</p>
<p>As an API, we will use <a href="https://github.com/mkdev-me/sinatra-api-example" target="_blank" rel="nofollow noopener">a small web application</a>, written in the framework, of Sinatra, which is written in Ruby. You do not need to write ruby code. To run the API on your machine, perform the following steps:</p>
<ol>
<li>Install Ruby if you do not yet have. Online set of guidelines on this subject, including the official website <a href="https://www.ruby-lang.org/en/" target="_blank" rel="nofollow noopener">https://www.ruby-lang.org/en/</a></li>
<li>Download the app <code>git clone https://github.com/mkdev-me/sinatra-api-example</code></li>
<li>Go to the folder with the application and run <code>bundle install</code></li>
<li>Then run <code>rake db:create db:migrate</code></li>
<li>Finally, run the application command <code>ruby app.rb</code></li>
</ol>
<p>Done! Your little backend ready to go at <code>localhost:4567</code>. Now we can update Angular.js application to work with the API.</p>
<p>We have already connected Restangular step setup of our application: you can see it in the list of dependencies in a file <code>bower.json</code>. Moreover, the library is already loaded as a module, pay attention to the line in <code>src/app/index.js</code> :</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">angular.module('ngmkdev', ['restangular', 'ui.router', 'ui.bootstrap'])</pre>
<p>Therefore, we can go directly to the code. First of all, we need to set the base URL, using which Restangular will build more links. To do this, the library has RestangularProvider provider that we can use in the config block in <code>src/app/index.js</code> :</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/index.js
angular.module('ngmkdev', ['restangular', 'ui.router'])
  .config(function ($stateProvider, $urlRouterProvider, RestangularProvider) {

    RestangularProvider.setBaseUrl("http://localhost:4567");
    &lt; … &gt;
});</pre>
<p>The main reference for the default will be a link to the server with our API. Now update <code>TransactionsStore</code> so that it uses data from the server. Add two new methods: <code>loadTransactions</code> load all the data from the server, and <code>addTransaction</code> add a new transaction.</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/components/transations_store.serve.js
angular.module('ngmkdev').factory('TransactionsStore', function(Restangular) {
  return {
    transactions: [],
    loadTransactions: function() {
      this.transactions = Restangular.all('transactions').getList().$object;
    },
    addTransaction: function(transaction) {
      var that = this;
      return Restangular.all('transactions').post({transaction: transaction}).then(function() {
        that.transactions.push(transaction);
      })
    },
    sum: function() {
      var sum = 0;
      this.transactions.forEach(function(el) {
        sum += parseFloat(el.amount);
      })
      return sum;
    }
  }
});</pre>
<p>Note the function <code>then()</code>. It is performed only when the completed request to add transaction. This mechanism is called the promises, which is an alternative for the usual jQuery callback mechanism. promise The difference is that we do not need to keep in mind when a callback is executed. Angular.js thus provides a guarantee that if the function A has finished its execution, the function B is executed (and only if the function A really well done).</p>
<p>In this case, we ensure that the array is updated only after the transaction is successfully saved a new transaction to the server. To reduce the number of server requests we will keep in memory all the transactions and update the array manually, instead of each time getting all transaction server.</p>
<p>Most Restangular functions return a promise-objects. For example, <code>getList()</code>, which we use for all transactions. To get yourself a transaction, we can either use <code>then()</code>, a method of <code>$object</code>, which immediately returns us all transactions.</p>
<p>Using the method of <code>all()</code>, we specify with some resource work. Restangular he guesses which links to send and receive data, provided that your application complies with REST API standards. Thus, <code>post()</code> will create a new record, <code>get()</code> will get a record, etc.</p>
<p>Controller code has not undergone major changes:</p>
<pre class="prettyprint lang-javascript" data-start-line="1" data-visibility="visible" data-highlight="" data-caption="">// src/app/main/transactions.controller.js
angular.module('ngmkdev').controller('TransactionsCtrl', function($scope, TransactionsStore) {

  TransactionsStore.loadTransactions();

  this.addTransaction = function() {
    TransactionsStore.addTransaction(this.newTransaction);
    this.resetTransaction();
  }

  this.resetTransaction = function() {
    this.newTransaction = {
      amount: 0.0,
      date: "1993-02-01",
      description: null
    }
  }
  this.transactions = TransactionsStore.transactions;
  this.resetTransaction();
});</pre>
<p>Now all new transactions will be stored in the database and then reload the page, they will not be lost.</p>
<p>You probably created numerous test transactions to see how everything works. Now you have to be on them as something to get rid of. Commit to the changes: <a href="https://github.com/mkdev-me/ng.mkdev/commit/a0629f595db4d49c7e7c956ffcefe1cdb1050be0" target="_blank" rel="nofollow noopener">a0629f</a>.</p>
<p>Homework:</p>
<ul>
<li>Add and implement the delete button transaction.</li>
</ul>
<p>This is the last article on Angular.js course. For 6 issues, we met with all the basic tools of modern frontend development and, following the best practices, a full written application running with the backend via the API. The knowledge gained will serve as an excellent foundation for writing more complex applications Angular.js. Write in the comments what you think about this series and how is your study and application Angular.js.</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/connect-api-backend-angular-js/">How to connect to the API backend Angular.js</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
	</item>
		<item>
		<title>Introduction to Node.JS development</title>
		<link>https://codemotion.us/introduction-node-js-development/</link>
		
		<dc:creator><![CDATA[Yaroslav Golovach]]></dc:creator>
		<pubDate>Wed, 19 Oct 2016 17:59:08 +0000</pubDate>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[the javascript]]></category>
		<guid isPermaLink="false">https://codemotion.ninja/?p=5118</guid>

					<description><![CDATA[<p>What is Node.js? Node.js (or simply Node) &#8211; is a server platform for working with JavaScript through a V8 engine. JavaScript performs an action on the client side, and the Node &#8211; on the server. With Node can write full applications. Node can work with external libraries, call the command of JavaScript code and run [&#8230;]</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/introduction-node-js-development/">Introduction to Node.JS development</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>What is Node.js?</h2>
<p>Node.js (or simply Node) &#8211; is a server platform for working with JavaScript through a V8 engine. JavaScript performs an action on the client side, and the Node &#8211; on the server. With Node can write full applications. Node can work with external libraries, call the command of JavaScript code and run the Web Server role.</p>
<p><strong>What is the advantage Node?</strong></p>
<p>C Node is easier to scale. If you connect to thousands of users Server Node operates asynchronously, that is, sets priorities and allocates resources more competently. Java is, for example, allocates for each connection a separate thread.</p>
<p><strong>Location Node generally come from?</strong></p>
<p>Node appeared in 2009 thanks to Ryan Dalu. Prior to that, the servers reigned approach &#8220;one thread per connection&#8221;, but Dahl came up to use the system, which focuses on events. That is reacting to an act or omission, and allocates a resource. The main purpose of Node &#8211; to build scalable network servers.</p>
<p><strong>Some of the major companies using Node?</strong></p>
<p>Of course, this is an incomplete list:</p>
<p><img loading="lazy" decoding="async" width="1024" height="332" class="alignnone size-medium wp-image-5200" src="https://codemotion.ninja/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332.jpg" alt="nodejs-post-1-img-1" srcset="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332.jpg 1024w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332-300x97.jpg 300w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332-768x249.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /><br />
<em>Source: strongloop.com</em></p>
<p>eBay is gradually <a href="http://www.ebaytechblog.com/2013/05/17/how-we-built-ebays-first-node-js-application/" target="_blank" rel="nofollow noopener">moving</a> to the Node, as well as a web version of <a href="https://www.paypal-engineering.com/2013/11/22/node-js-at-paypal/" target="_blank" rel="nofollow noopener">PayPal</a>. In LinkedIn more in 2012 <a href="http://highscalability.com/blog/2012/10/4/linkedin-moved-from-rails-to-node-27-servers-cut-and-up-to-2.html" target="_blank" rel="nofollow noopener">moved</a> to the Ruby On Rails on the Node and immediately felt the benefits of this platform: 27 servers showed a 20-fold increase in speed.</p>
<p><strong>What can I write to Node?</strong></p>
<p>A full program for the Web, Linux, OS X and Windows.</p>
<p><strong>And if more?</strong></p>
<p>No problem. Node is useful for creating API &#8211; there are already comfortable library like <a href="https://strongloop.com/node-js/loopback-framework/" target="_blank" rel="nofollow noopener">Loopback</a>.</p>
<p>In this language, you can write cross-platform applications &#8211; in conjunction mobile + desktop Node helps to achieve synchronicity. For example, when you write a message with the phone, it immediately appears on the laptop and on the Web.</p>
<p><strong>And something fashionable Node knows?</strong></p>
<p>Of course. Node &#8211; is the home of all &#8220;Internet of things» (Internet of Things, IoT). Thermostats, fitness trackers &#8211; all this can be programmed via the Node.</p>
<p><strong>Node accidentally losing popularity?</strong></p>
<p>Quite the contrary. Here is a chart of interest to the Node since 2009 in Google search:</p>
<p><img loading="lazy" decoding="async" width="870" height="474" class="alignnone size-medium wp-image-5123" src="https://codemotion.ninja/wp-content/uploads/2016/10/nodejs-post-1-img-2.png" alt="nodejs-post-1-img-2" srcset="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-2.png 870w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-2-300x163.png 300w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-2-768x418.png 768w" sizes="(max-width: 870px) 100vw, 870px" /></p>
<p>Interest in the Node is growing rapidly and already passes on this indicator, Ruby and Objective-C.</p>
<p>NodeJS, otherwise known as Node. JS development environment, is a runtime environment, based on the V8 interpreter, which converts JavaScript into a full-fledged general-purpose language. Event-driven programming methods are used in Node.JS web development. Node has its own API for interactions with input-output devices. That is mainly used for high-performance web servers and distributed web applications development, although Node.JS developers may also use it for desktop window applications.</p>
<p>Now after a brief terminological definition of Node by an experienced Node.JS developer, we’d like to provide some basic info on web development with node and express.<br />
So let’s take a glance under the bonnet of Node.JS, see it main elements and sort out pros and cons.</p>
<h4>JavaScript in Node. JS development</h4>
<p><img loading="lazy" decoding="async" width="1222" height="688" class="alignnone size-medium wp-image-5133" src="https://codemotion.ninja/wp-content/uploads/2016/10/nodejs-post-1-img.jpg" alt="nodejs-post-1-img" srcset="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img.jpg 1222w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-300x169.jpg 300w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1024x577.jpg 1024w, https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-768x432.jpg 768w" sizes="(max-width: 1222px) 100vw, 1222px" /></p>
<p>JavaScript is an easy-to-learn scenario programming language featuring automatic memory management. Development of JavaScript was focused on the similarity of the syntax with the Java language, the simplicity of working with it for people without specialized education and lowest possible entry threshold. To date, JavaScript is widely used as a basic scenario language for interactive web pages. JavaScript is an implementation of the ECMAScript scenario language (ECMA-262 standard).</p>
<p>Scripting or glue languages operate with ready software components describing scenarios of their interactions. Most of them (including JS) are interpreted.</p>
<table>
<thead>
<tr>
<th colspan="3">Programming Languages</th>
</tr>
</thead>
<tbody>
<tr>
<th>Interpreted</th>
<th>Precompiled</th>
<th>Compiled (system languages)</th>
</tr>
<tr>
<td>Interpreter is fed a script, executing it block by block</td>
<td>Scenarios are precompiled into an intermediate &#8211; bytecode</td>
<td>Program code is compiled into a binary executable</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<p>Being an interpreted language brings two major advantages to JS. First &#8211; due to step-by-step execution it allows some in-flight adjustments, second one is cross-platform nature of scenarios, they could be launched wherever there is an interpreter.</p>
<p>JavaScript also features automatic memory management that carries memory allocation and releasing for program objects based on their use. It strips this additional responsibility off the developers, which is quite useful for novice and amateur coders.<br />
Gradation of learning is generally a great trait of JavaScript. One can study the basics and that would be enough for most use cases, while interested users can go deeper, up to serious professional levels.<br />
JavaScript’s usability and ease of learning led to its widest spread, making it the standard scripting language for HTML. All modern browsers for major operating systems have built-in JavaScript interpreters.</p>
<p>However, JS also has some shortcomings:</p>
<ul>
<li>Lack of dependency control means and namespaces isolation;</li>
<li>Lack of modularity and the components management system;</li>
<li>Lack of standard general purpose functions libraries, file system interaction and input-output devices control functions;</li>
<li>Software developed with the use of interpreted languages is considerably slower than with the use of traditional system languages.</li>
</ul>
<p>Node.JS development was started specifically for leveling these disadvantages</p>
<h4>Node. JS application</h4>
<p>Ryan Dahl proposed Node development in 2009 as a means of creating effective scalable web-servers. Initially, platform ideology was focused on event-driven programming, as opposed to the traditional system of multi-threaded programming. The advantages of an event-oriented model are considerable simplicity and Node. JS performance. Node.JS has brought event-driven, highly scalable, callback operated goodness to web-servers, ditching their high concurrency problems, thus boosting up performance. And since JavaScript was so popular Node’s target audience &#8211; the enormous web-development community &#8211; immediately got their hands on a comprehensible and easy to use, yet powerful tool.</p>
<p><img loading="lazy" decoding="async" width="510" height="449" class="alignnone size-medium wp-image-5131" src="https://codemotion.ninja/wp-content/uploads/2016/10/node-js-processing-model.png" alt="node-js-processing-model" srcset="https://codemotion.us/wp-content/uploads/2016/10/node-js-processing-model.png 510w, https://codemotion.us/wp-content/uploads/2016/10/node-js-processing-model-300x264.png 300w" sizes="(max-width: 510px) 100vw, 510px" /></p>
<h4>Dependencies, package management, etc.</h4>
<p>First two named JS shortcomings are effectively dealt with Node’s Unified API, allowing combining Node with browsers and Document Databases, and the “<a href="https://en.wikipedia.org/wiki/Npm_(software)" target="_blank" rel="nofollow noopener">npm</a>” &#8211; default Node’s packet manager.</p>
<h4>Libraries</h4>
<p>Node’s audience is huge. Seriously huge. Immense community support brings tons of open-source libraries, some providing such supermodern functionality, we’re just looking forward to use. Industry is very favourable to Node.JS, there’s even a <a href="http://nodeconf.com/" target="_blank" rel="nofollow noopener">NodeConf</a> held each Summer. Community has developed several frameworks assisting all the input-output issues and providing support for accelerating software development.</p>
<h4>V8 in Node.JS development environment</h4>
<p>V8 interpreter is an open source JavaScript (JS) engine developed by Google. Its task is the analysis of scripts written in JS and their execution. It differs favorably from competing engines by the speed, scalability, and efficient memory manager, which is why it was chosen as the basis for the Node. V8 usage is a great deal of overcoming speed issues of interpreted languages.</p>
<p>So as you see, Node.JS is a modern and powerful instrument, highly supported in industry and providing great possibilities for web-server development. Highly skilled team of Node.JS pros is very effective and able to show record breaking development terms.</p>
<p>The post <a rel="nofollow" href="https://codemotion.us/introduction-node-js-development/">Introduction to Node.JS development</a> appeared first on <a rel="nofollow" href="https://codemotion.us">Codemotion</a>.</p>
]]></content:encoded>
					
		
		
		
		<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332-150x150.jpg" />
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332.jpg" medium="image">
			<media:title type="html">nodejs-post-1-img-1</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-1-1024x332-150x150.jpg" />
		</media:content>
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-2.png" medium="image">
			<media:title type="html">nodejs-post-1-img-2</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-2-150x150.png" />
		</media:content>
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img.jpg" medium="image">
			<media:title type="html">nodejs-post-1-img</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/nodejs-post-1-img-150x150.jpg" />
		</media:content>
		<media:content url="https://codemotion.us/wp-content/uploads/2016/10/node-js-processing-model.png" medium="image">
			<media:title type="html">node-js-processing-model</media:title>
			<media:thumbnail url="https://codemotion.us/wp-content/uploads/2016/10/node-js-processing-model-150x150.png" />
		</media:content>
	</item>
	</channel>
</rss>
