<?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/"
	>

<channel>
	<title>Gayan Sampath &#8211; The SIGMA</title>
	<atom:link href="https://danushka96.github.io/sigma/index.php/author/gayan/feed/" rel="self" type="application/rss+xml" />
	<link>https://danushka96.github.io/sigma/</link>
	<description>&#60;For Those Who Code/&#62;</description>
	<lastBuildDate>
	Sat, 02 Mar 2019 16:57:34 +0000	</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.1.1</generator>
	<item>
		<title>Components in Angular</title>
		<link>https://danushka96.github.io/sigma/index.php/2019/01/24/components-in-angular/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2019/01/24/components-in-angular/#respond</comments>
				<pubDate>Thu, 24 Jan 2019 16:25:24 +0000</pubDate>
		<dc:creator><![CDATA[Gayan Sampath]]></dc:creator>
				<category><![CDATA[angular.js]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[attibute]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[component]]></category>
		<category><![CDATA[decorator]]></category>
		<category><![CDATA[index.html]]></category>
		<category><![CDATA[metadata]]></category>
		<category><![CDATA[method]]></category>
		<category><![CDATA[root component]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[typescript]]></category>
		<category><![CDATA[view]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1700</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">5</span> <span class="rt-label rt-postfix">minutes</span></span> කොහොමද යාලුවනේ! ඔන්න මං අදත් ආවා Angular පාඩම් මාලාවේ තුන්නවෙනි පාඩමත් සමගින්.කලින් පාඩමේදී අපි කතා කලා Angular වල folder structure එක සහ index page එක render වුන විදිය ගැන. අද පාඩමේදී අපි කතා කරන්ට බලාපොරොත්තු වෙන්නේ Angular වල components ගැන.ගොඩක් දේවල් කතා කරන්න තියන නිසා කෙලින්ම පාඩමට බහිමු. Angular වල<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2019/01/24/components-in-angular/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/24/components-in-angular/">Components in Angular</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">5</span> <span class="rt-label rt-postfix">minutes</span></span>
<p>කොහොමද යාලුවනේ! ඔන්න මං අදත් ආවා Angular පාඩම් මාලාවේ තුන්නවෙනි පාඩමත් සමගින්.<a href="https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/">කලින් පාඩමේදී</a> අපි කතා කලා Angular වල folder structure එක සහ index page එක render වුන විදිය ගැන. අද පාඩමේදී අපි කතා කරන්ට බලාපොරොත්තු වෙන්නේ Angular වල components ගැන.ගොඩක් දේවල් කතා කරන්න තියන නිසා කෙලින්ම පාඩමට බහිමු.</p>



<p>Angular වල component එකක් හැදිලා තියෙන්නේ Template , class හා metadata කියන කොටස් තුනේ එකතුවෙන්.view එකට අදාලව තියන HTML code ඔක්කොම වගේ අයිති වෙන්නේ මෙන්න මේ Template කියන කොටසට…component එකේ properties , methods හා view එකට අදාලව තියන logic තියාගන්නේ component class එක ඇතුලේ..metadata කියන කොටසේ තමයි තියෙන්නේ component එක අපේ app එකට සම්බන්ධ(attach)  කිරීමට අදාල විස්තර…Metadata define කරලා තියෙන්නේ Decorator කියලා එකකින්.Decorator එකක් කියන්නේ අපේ component එක app එකට සම්බන්ධ කිරීමට අදාල විස්තර සපයන විශේෂ function  එකක්.component එකක ප්‍රධාන කොටස් තුන ගැන සරලව ඔය ටික තමයි කියන්න තියෙන්නේ…දැන් අපි එකින් එක ගැන තව පොඩ්ඩක් කතා කරලා බලමු.</p>



<p>මුලින්ම අපි අලුත් component එකක් හදාගමු. ඔයාලගේ terminal එකේ අපි කලින් හදා ගත්ත angular project එක ඇතුලට ගිහින්<code>ng g c&nbsp;&lt;component_name&gt;</code>  කියන command එක දුන්නාම අලුත් component එකක් හදා ගන්න පුලවන්.ඔන්න ඔය විදියට component එකක් හදා ගත්තාම ඔයාලට පේනවා file 4 ක් තියන folder එකක් තමයි component එකක් විදියට හැදිලා එන්නේ.අන්න ඒ file 4 ගැන සලකා බැලුවොත් , typescript (.ts ) file එකේ තමයි component එකේ class එකයි metadata යි තියා ගන්නේ.html file එකේ තමයි component එකේ view එක තියෙන්නේ. component  එකකට අදාල styles තියාගන්නේ මෙන්න මේ .css කියන css file එක ඇතුලේ..අනික් file එක(.spec.ts) නම් පාවිච්චි කරන්නේ testing වලට.</p>



<p>ඔයාලට මතකද දන්නේ නෑ මං කලින් පාඩමේදී පාවිච්චි කලා root component කියලා වචනයක්..ඒ වෙලාවෙදි ඒක ගැන කතා කලේ නැති වුනාට දැන් අපි ඒ ගැන පොඩ්ඩක් කතා කරලා බලමු.root component එක තමයි අපේ app එකේ තියන ප්‍රධානම component එක.අපි අලුතින් හදන component දාන්නේ මෙන්න මේ root component එක ඇතුලට.මුලින්ම අපිට index page එක render වෙද්දි පෙනුනේ මෙන්න මේ root component එකේ elements තමයි.මුලින්ම අපි root component එකේ typescript file එකට ගිහින් බලමු.</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-4.jpg" alt="" data-id="1702" data-link="https://danushka96.github.io/sigma/?attachment_id=1702" class="wp-image-1702" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-4.jpg 821w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-4-300x99.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-4-768x253.jpg 768w" sizes="(max-width: 821px) 100vw, 821px" /></figure></li></ul>



<p>ඔන්න ඔහොම තමයි root component එකට අදාල typescript file එක( app.component.ts file ) තියෙන්නේ. මෙහි මුලින්ම තියනවා Metadata..</p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip.png" alt="" class="wp-image-1703" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip.png 821w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-300x99.png 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-768x253.png 768w" sizes="(max-width: 821px) 100vw, 821px" /></figure>



<p>Metadata ගැන බැලුවොත්, මුලින්ම තියන selector එක , component එක html file එකට attach කරන විට  custom html tag එකක් විදියට වැඩ කරනවා &#8230;අපි open කරලා තියෙන්නේ root component එකට අදාල typescript file එක නිසා එහි selector එක නම් කරලා තියනවා app-root කියලා..දැන් ඔයාලට index.html file එක ඇතුලට ගියොත් බලාගන්න පුලුවන් app-root කියලා custom html tag එකක් තියනවා</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-1.png" alt="" data-id="1704" data-link="https://danushka96.github.io/sigma/?attachment_id=1704" class="wp-image-1704" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-1.png 852w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-1-300x130.png 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-1-768x334.png 768w" sizes="(max-width: 852px) 100vw, 852px" /></figure></li></ul>



<p>ඔන්න ඔය custom html tag එක තියන තැනට තමයි root component එක index page එකට attach කරලා තියෙන්නේ.</p>



<p>component එකක් තවත් component එකකට හරි අදාල html page එකකට හරි attach කරන්න පුලුවන් විදි තුනක් තියනවා..පලමු ක්‍රමය තමයි selector එක custom html tag එකක් විදියට පාවිච්චි කරලා attach කරන්න පුලුවන්..අපි ඉහලින් කතා කලේ අන්න ඒ ක්‍රමය ගැන තමයි..දෙවෙනි ක්‍රමය තමයි selector එක class එකක් විදියට පාවිච්චි කරල attach කරන්නත් පුලුවන්..code එක ගත්තොත් මෙන්න මේ වගේ..</p>



<p><strong><em>app-component.ts</em></strong></p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-2.png" alt="" data-id="1705" data-link="https://danushka96.github.io/sigma/?attachment_id=1705" class="wp-image-1705" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-2.png 793w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-2-300x113.png 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-2-768x290.png 768w" sizes="(max-width: 793px) 100vw, 793px" /></figure></li></ul>



<p><strong><em>index.html</em></strong></p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-3.png" alt="" data-id="1707" data-link="https://danushka96.github.io/sigma/?attachment_id=1707" class="wp-image-1707" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-3.png 760w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-3-300x158.png 300w" sizes="(max-width: 760px) 100vw, 760px" /></figure></li></ul>



<p>තුන්වෙනි විදිය තමයි selector එක attribute එකක් විදියට පාවිච්චි කරලත් component එක page එකට attach කරන පුලුවන්.ඒකේ code එක ගත්තොත් මෙන්න මේ වගේ..</p>



<p><strong><em>app.component.ts﻿</em></strong></p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-4.png" alt="" class="wp-image-1708" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-4.png 512w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-4-300x154.png 300w" sizes="(max-width: 512px) 100vw, 512px" /></figure>



<p><strong><em>Index.html</em></strong></p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-5.png" alt="" data-id="1709" data-link="https://danushka96.github.io/sigma/?attachment_id=1709" class="wp-image-1709" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-5.png 738w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-5-300x152.png 300w" sizes="(max-width: 738px) 100vw, 738px" /></figure></li></ul>



<p>ඔන්න ඔය ක්‍රම තුනෙන් කැමති විදියක් පාවිච්චි කරලා අලුත් component එකක් html page එකට attach කරන්න පුලුවන්.</p>



<p>Metadata වල ඊලගට තියෙන්නේ templateurl එකයි styleurls එකයි. templateurl එකෙන් තමයි අපේ component එකේ html page එක තියන තැන පෙන්නනේ. component එකේ styles තියන css file එක තියන තැන පෙන්නනේ මෙන්න මේ styleurls එකෙන්.component එකකට අදාල metadata නම් තියෙන්නේ ඔච්චරයි..</p>



<p>typescript file එකේ metadata වලට යටින් තියෙන්නේ component එකේ class එක..component එකේ methods , properties තියාගන්නේ මෙන්න මේ component class එක ඇතුලේ. මුලින් අපි කතා කලානේ root componet එකේ metadata ගැන.දැන් බලමු root componet එකේ class එක ගැන.</p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-6.png" alt="" class="wp-image-1710" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-6.png 665w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-6-300x149.png 300w" sizes="(max-width: 665px) 100vw, 665px" /></figure>



<p>ඉහලදි මම පෙන්නපු විදියට root component එකේ typescript file එක ඔන්න ඔය විදියට තමයි තියෙන්නේ. root component කියලා metadata වලට යටින් තියෙන්නේ component class එක.root component class එක ගත්තොත් ඔයාලට පේනවා ඇති title කියලා property එකක් define කරලා තියනවා..ඔන්න ඔය විදියට අපේ component එකට අවශය properties , methods ඕනි තරමක් define කරන්න පුලුවන් මෙන්න මේ component class එක ඇතුලේ.</p>



<p>component එකක තියන අනෙක් කොටස තමයි view එක .component එකේ view එක පෙන්නනේ මෙන්න මේ html file එකෙන්.root component එකේ view එක බැලුවොත් මෙන්න මේ වගේ view එකක් තමයි තිබුනේ.</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-1024x462.jpg" alt="" data-id="1573" data-link="https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/a/" class="wp-image-1573" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-1024x462.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-300x135.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-768x347.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a.jpg 1351w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></li></ul>



<p>root component එකට අදාල html file එක බැලුවොත් මෙන්න මේ වගේ.</p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-7.png" alt="" class="wp-image-1711" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-7.png 928w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-7-300x156.png 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-7-768x399.png 768w" sizes="(max-width: 928px) 100vw, 928px" /></figure>



<p>මුලින්ම තියනවා well come message එක.</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-8.png" alt="" data-id="1712" data-link="https://danushka96.github.io/sigma/?attachment_id=1712" class="wp-image-1712" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-8.png 849w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-8-300x44.png 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-8-768x112.png 768w" sizes="(max-width: 849px) 100vw, 849px" /></figure></li></ul>



<p>ඔයාලට මතක ඇති root component class එකේ property එකක් තිබුණා title කියලා.අන්න ඒ title property එක තමයි well come massage එක වදියට මෙතනදි display වෙලා තියෙන්නේ.ඔන්න ඔය වඳියට component class එකේ define කරන properties සහ methods අපේ component එකේ view එකට අවශය විදියට display   කරලා පෙන්න පුලුවන්.component ගැන කියන්න තියෙන්නෙනම් ඔච්චරයි. component ගැන තවමත් පොඩි  හෝ අවුලක් තියනවනම්  මෙන්න මේ උදාහරණයත් බලන්නකෝ.</p>



<p>මෙහිදී මම කරන්න යන්නේ අලුතින් component එකක් හදාගෙන ඒක root component එකට attach කරලා display කරන එක.</p>



<p>මුලින්ම මම component එකක් හදා ගන්නම් <em>&#8220;firstComponent&#8221;</em> කියලා.</p>



<p><code>ng g c firstComponent</code></p>



<p>හරි, දැන් ඔයාලට හැදිලා එන්න ඇති file 4 ක් තියන &#8220;firstComponent&#8221; කියලා folder එකක්. මුලින්ම මම හදා ගත්ත අලුත් component එකේ property එකක් define කරනවා &#8220;header&#8221; කියලා. &#8220;header &#8221; එකට value එකක් දෙනවා &#8220;This is my first component &#8221; කියලා.</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-9.png" alt="" data-id="1713" data-link="https://danushka96.github.io/sigma/?attachment_id=1713" class="wp-image-1713" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-9.png 701w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/tempsnip-9-300x151.png 300w" sizes="(max-width: 701px) 100vw, 701px" /></figure></li></ul>



<p>හරි , දැන් ඒ define කරපු property එක මෙන්න මේ විදියට html page එකට set කරමු.</p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-5.jpg" alt="" class="wp-image-1714" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-5.jpg 769w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-5-300x34.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-5-768x86.jpg 768w" sizes="(max-width: 769px) 100vw, 769px" /></figure>



<p>හරි දැන් හදා ගත්ත component එක root component එකට attach කරමු.  අපේ හදා ගත්ත component එක  පැහැදිලිව පෙනෙන්න ඕනි නිසා root component එකේ දැනට තියන elements delete කරලා අපේ අලුත් component එක attach කරමු.හරියට මෙන්න මේ වගේ.</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-6.jpg" alt="" data-id="1715" data-link="https://danushka96.github.io/sigma/?attachment_id=1715" class="wp-image-1715" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-6.jpg 629w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-6-300x73.jpg 300w" sizes="(max-width: 629px) 100vw, 629px" /></figure></li></ul>



<p>ඔන්න ඔය විදියට අලුත් component එක  attach කලාට පස්සේ මෙන්න මේ වගේ view එකක් ඔයාලට දැක ගන්න පුලුවන්</p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-7.jpg" alt="" class="wp-image-1716" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-7.jpg 494w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture-7-300x131.jpg 300w" sizes="(max-width: 494px) 100vw, 494px" /></figure>



<p>හරි, components ගැන හොදටම තේරෙන්න ඇති කියලා හිතනවා..තවත් මොකක් හරි අව්ලක් තියනවනම් comment එකක් දාන්න.මීලඟ පාඩමෙන් අපි බලමු Angular වල data binding ගැන.මීලඟ පාඩමෙන් හමුවන තුරු  ඔබට  සුභ දවසක් ! ☺☺</p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/24/components-in-angular/">Components in Angular</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2019/01/24/components-in-angular/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Angular 7 මුල සිට ඉගෙන ගනිමු &#8211; 2 කොටස</title>
		<link>https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/#respond</comments>
				<pubDate>Sat, 19 Jan 2019 02:54:18 +0000</pubDate>
		<dc:creator><![CDATA[Gayan Sampath]]></dc:creator>
				<category><![CDATA[angular.js]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[bootstrap]]></category>
		<category><![CDATA[json]]></category>
		<category><![CDATA[testnig]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1588</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span> ආයුබෝවන් හැමෝටම! ඔන්න මම අදත් ආවා Angular පාඩම් මාලාවේ දෙවන පාඩමත් සමගින්.අපි කලින් පාඩමේ කතා කලා මොකද්ද Angular කියන්නේ, ඇයි Angular පාවිච්චි කරන්නේ කියලා හා කොහොමද Angular install කරලා run කරන්නේ කියන එක ගැන.කලින් පාඩම මඟ හැරුන කෙනෙක් ඉන්නවනම් මෙතනින් ගිහින් බලන්නත් පුලුවන්..හරි එහෙනන් අපි අද පාඩමට බහිමු. මුලින්ම අපි<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/">Angular 7 මුල සිට ඉගෙන ගනිමු &#8211; 2 කොටස</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span>
<p>ආයුබෝවන් හැමෝටම! ඔන්න මම අදත් ආවා Angular පාඩම් මාලාවේ දෙවන පාඩමත් සමගින්.අපි කලින් පාඩමේ කතා කලා මොකද්ද Angular කියන්නේ, ඇයි Angular පාවිච්චි කරන්නේ කියලා හා කොහොමද Angular install කරලා run කරන්නේ කියන එක ගැන.කලින් පාඩම මඟ හැරුන කෙනෙක් ඉන්නවනම් <a href="https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/">මෙතනින්</a> ගිහින් බලන්නත් පුලුවන්..හරි එහෙනන් අපි අද පාඩමට බහිමු.</p>



<p>මුලින්ම අපි Angular වල folder structure එක ගැන බලමු..කලින් පාඩමේ අපි හදා ගත්ත angular project එක මොකක් හරි text editor එකකින් open කලාම මෙන්න මේ වගේ folder structure එකක් දැක ගන්ට පුලුවන්..</p>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/folder.jpg" alt="" class="wp-image-1589" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/folder.jpg 314w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/folder-300x268.jpg 300w" sizes="(max-width: 314px) 100vw, 314px" /></figure></div>



<p>මෙහි අපිට දැක ගන්න පුලුවන් e2e, node module හා src කියලා ලොකු folder තුනකුයි තව .json file කිහිපයකුයි .මුලින්ම අපි ලොකු folder තුන ගැන කතා කරමු.</p>



<p><strong>e2e </strong>&#8211; මේ folder එකේ තියන files  පාවිච්චි කරන්නේ testing වලට.</p>



<p><strong><em>node module</em></strong> &#8211; මේ folder එකේ තමයි අපේ project එකට අදාල modules install කරලා තියා ගන්නේ.උදාහරණයක් විදියට ගත්තොත් අපේ project එකට bootstrap ඕනි කියලා හිතමුකෝ&#8230; bootstrap install වෙන්නේ මෙන්න මේ node module කියන folder එකේ තමයි.</p>



<p><strong><em>src</em></strong> &#8211; මේ folder එකේ තමයි අපේ project එකට අවශය වැදගත්ම files ටික තියෙන්නේ.src folder එක open කරලා බැලුවොත් මුලින්ම අපිට දැක ගන්න පුලුවන් <strong>app</strong> කියලා folder එකක්..අපේ project එකට අදාල වන component වල files තියා ගන්නේ මෙන්න මේ app folder එක ඇතුලේ.තවද,<strong>main.ts</strong> file එක, <strong>index.html</strong> file එක වගේ ඒවා තබා ගන්නෙත් මෙන්න මේ src folder එක ඇතුලේ.</p>



<p><strong><em>package.json</em></strong> &#8211; මෙන්න මේ file එකේ තමයි තියෙන්නේ අපේ project එකට අදාලව තියන dependency වල විස්තර හා install කරලා තියන modules වල විස්තර..මේ විස්තර වලට අදාලව තියෙන dependency හා modules  තියෙන්නේ අපි කලින් සදහන් කල node module කියන folder එක ඇතුලේ. පහලින් ඔයාලට බලා ගන්න පුලුවන් package.json file එකේ තියන code line කීපයක්..</p>



<div class="wp-block-image"><figure class="aligncenter"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/li.jpg" alt="" class="wp-image-1590"/></figure></div>



<p><em>මේ code line කිහිපය දැක්කට පස්සේ ඔයාලාට මතක් වෙන්න ඇති අපි කලින් පාඩමේ කතා කරපු ng serve හා npm start කියන command දෙක.කලින් පාඩමේ කිව්ව විදියට Angular වල server එක start කරන්න තමයි මේ command දෙක ගත්තේ..මේවා දෙකෙන් කරන වැඩේ එකම වුනාට වැඩකරන විදිය වෙනස්.. ng serve command එකෙන් වෙන්නේ server එකට direct ම කියනවා start වෙන්න කියලා&#8230;නමුත් npm start command එක දුන්නාම වෙන්නේ internally ng serve කියන command එක run වෙලා තමයි server එක start වෙන්නේ..කෙලින්ම server එක start කරන්න යන්නේ නෑ&#8230;ඔය වගේම තමයි npm build හා ng build , npm test හා ng test &#8230;යන command වැඩ </em>කරන්නනෙත්<em>..මේ ටික නම් කිව්වේ ඔයාලගේ අමතර දැනුමට..කෝකටත් කියලා දැනගෙන ඉන්න එක හොදයිනේ..</em>😀😀..</p>



<p>හරි ඔන්න ඔය වගේ folder structure එකක් තමයි Angular වල තියෙන්නේ…දැන් අපි බලමු Angular වල index page එක render වුනේ කොහොමද කියලා.</p>



<p>ඔයාලට මතක ඇති අපි කලින් පාඩමේදී කතා කලා කොහොමද Angular project එක run කරන්නේ කියන එක ගැන..එහිදී Angular වල server එක start කරලා ng -o හරි ng -open හරි ගැහුවාම Auto ම localhost:4200 port එකේ app එක run වුනා.අපි දැං බලමු කොහොමද මේ වැඩේ වුනේ කියලා.localhost:4200 කියන url එක ආවාම මුලින්ම request එක එන්නේ src folder එක ඇතුලේ තියන main.ts කියන typescript file එකට..ඊට පස්සේ main.ts file එකෙන්  src/app folder එකේ තියන app.module.ts  file එකට (root module) call වෙනවා ..ඊට පස්සේ app.component.ts කියන root component එකේ class එකට ඇවිත් තමයි අවසානයේදී app.component.html page එක render  වෙලා පෙන්නුවේ ..හරි හැටි තේරුනේ නැතිනම් අවුලක් ගන්න එපා ..ඊලග පාඩමේදී හරියටම තේරේවි.</p>



<p style="text-align:left" class="has-background has-white-background-color">හරි අදට අපි කතා කරන්න බලාපොරොත්තු වෙන්නේ ඔච්චරයි..මීලඟ පාඩමේදී අපි බලමු Angular වල component ගැන..post එක ගැන ඔයාලගේ අදහස comment එකක් දාන්නත් අමතක කරන්න එපා..මීලඟ පාඩමෙන් හමුවනතුරු ඔබට සුභ දවසක්!  !</p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/">Angular 7 මුල සිට ඉගෙන ගනිමු &#8211; 2 කොටස</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2019/01/19/angular-7-step2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
							</item>
		<item>
		<title>Angular7 මුල සිට ඉගෙන ගනිමු-1 කොටස</title>
		<link>https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/</link>
				<comments>https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/#comments</comments>
				<pubDate>Wed, 16 Jan 2019 03:41:40 +0000</pubDate>
		<dc:creator><![CDATA[Gayan Sampath]]></dc:creator>
				<category><![CDATA[angular.js]]></category>
		<category><![CDATA[web development]]></category>
		<category><![CDATA[angular]]></category>
		<category><![CDATA[MEAN]]></category>
		<category><![CDATA[mongo DB]]></category>
		<category><![CDATA[nodejs]]></category>
		<category><![CDATA[npm]]></category>

		<guid isPermaLink="false">https://danushka96.github.io/sigma/?p=1551</guid>
				<description><![CDATA[<p><span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span> මුලින්ම ආයුබෝවන් කියනවා යාලුවෝ හැමෝටම..ගොඩ කාලෙකට පස්සේ ඔන්න මං ඇරගෙන ආවා අලුත්ම පාඩම් මාලාවක්..thesigma blog අඩවියත් සමග නිරන්තරයෙන් රැදී සිටි යාලුවෝ නම් දන්නවා අපි කලින් අපි කලින් පාඩමේ කතා කලා MEAN stack වල Database system එක වන mongoDB ගැන..ඒ පාඩම් ටික කලින් මඟ හැරුන කෙනෙක් ඉන්නවනම් මෙතනින් ගිහින් බලන්න පුලුවන්..අද<a class="moretag" href="https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/"> Read more&#8230;</a></p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/">Angular7 මුල සිට ඉගෙන ගනිමු-1 කොටස</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></description>
								<content:encoded><![CDATA[<span class="rt-reading-time" style="display: block;"><span class="rt-label">Reading Time: </span> <span class="rt-time">3</span> <span class="rt-label rt-postfix">minutes</span></span>
<p>මුලින්ම ආයුබෝවන් කියනවා යාලුවෝ හැමෝටම..ගොඩ කාලෙකට පස්සේ ඔන්න මං ඇරගෙන ආවා අලුත්ම පාඩම් මාලාවක්..thesigma blog අඩවියත් සමග නිරන්තරයෙන් රැදී සිටි යාලුවෝ නම් දන්නවා අපි කලින් අපි කලින් පාඩමේ කතා කලා  MEAN stack  වල Database system එක  වන mongoDB  ගැන..ඒ පාඩම් ටික කලින් මඟ හැරුන කෙනෙක් ඉන්නවනම් <a href="https://danushka96.github.io/sigma/index.php/category/web-development/mean-stack/">මෙතනින්</a> ගිහින් බලන්න පුලුවන්..අද මම පටන් ගන්න යන්නේ ඒ පාඩම් මාලාවේ දෙවන දිගහැරුමයි..ඒ තමයි  <strong>Angular</strong>  .</p>



<p>ඇත්තටම කියනවනම් Angular කියන්නේ ඉතාම කෙටි කාලෙකින් මෑත කාලීනව ගොඩක් ජනප්‍රිය වුන javascript front end framework(client side frame work) එකක්.2016  September 14  තමයි මුලින්ම Angular හදුන්වා දෙන්නේ..ඊටපස්සේ 2017 march 23 දී Angular version 4 ද, 2017 november 1 දී Angular version 5 ද, 2018  May 4 දී Angular version 6 ද හදුන්වා දෙනවා ..මං මේ post එක ලියන මේ මොහොතේ තියන latest ම version එක තමයි 2018  October  මාසයේ හදුන්වා දුන් Angular version 7..පේනවනේ නේද  මේ  frame work එක දියණු වෙලා තියන ඉක්මන😃😃😃..ඇත්තටම Angular හදුන්වා දුන්නේ google වුනාට microsoft ලාගේ typescript language එකත් මේකේ තියනවා..ඒ ගැන අපි පස්සේ හෙමීට බලමුකෝ..😀😀</p>



<p>ඇත්තටම  මොකද්ද    මේ  Angular වල තියෙන විශේෂත්වය ..ඒ තමයි එක page එකක ඉදලා තවත් page එකකට යද්දි url එකට අදාලව component වෙනස් වීමක් පමණයි වෙන්නේ..මුලු page එකම refresh වීමක් වෙන්නෑ…ඔන්න ඔය නිසා අපිට පුලුවන් අපේ app එකේ efficiency එක වැඩි කර ගන්න..ඔන්න ඕක තමයි Angular frame work එකේ තියන ප්‍රධානම විශේෂත්වය..හරි එහෙනන්  Angular ගැන පොඩි හෝ idea එකක් ගන්න ඇති කියලා හිතනවා..අපි දැන් බලමු Angular කොහොමද install කරගන්නේ කියලා..</p>



<p>මේ සදහා අපිට මුලින්ම nodejs සහ npm ( Node Package Manager  ) install කර ගන්න වෙනවා..සාමානයයෙන් nodejs intall කරනකොට npm auto ම install වෙනවා..පහල තියන url එකෙන් ගිහින් ඔයාගේ machine එකට අදාල nodejs version එක <a href="https://nodejs.org/en/">download</a> කරලා install කර ගන්න පුලුවන්..</p>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap4-1024x502.jpg" alt="" class="wp-image-1554" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap4-1024x502.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap4-300x147.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap4-768x377.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap4.jpg 1350w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>ඔන්න ඔය විදියට install කර ගත්ත nodejs version එක අපිට බලන්න පුලුවන් command prompt එකේ ng -v ලෙස type කරලා..npm -v ලෙස type කරලා npm version එක බලන්න පුලුවන්.ඔන්න ඔය ටික තමයි prerequisites වෙන්නේ Angular සමග වැඩ කරද්දි.</p>



<p>ඔන්න ඔය prerequisites satisfy කලාම අපිට පුලුවන් අලුත් Angular project එකක් start කරන්න.මේ සදහා ng new &lt;project_name&gt; කියන command එක පාවිච්චි කරන්න පුලුවන්..හරි මම Desktop එකේ අලුත් project එකක් හදනවා angular කියලා..ඊට අදාල command ටික මෙන්න මේ විදියට run කරන්න පුලුවන්..</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture1-1-1024x102.jpg" alt="" data-id="1566" data-link="https://danushka96.github.io/sigma/?attachment_id=1566" class="wp-image-1566" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture1-1-1024x102.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture1-1-300x30.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture1-1-768x76.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/Capture1-1.jpg 1366w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></li></ul>



<p>ඊටපස්සේ මෙන්න මේ වගේ files ගොඩක් Download වෙනවා..</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap2-2-1024x492.jpg" alt="" data-id="1568" data-link="https://danushka96.github.io/sigma/?attachment_id=1568" class="wp-image-1568" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap2-2-1024x492.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap2-2-300x144.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap2-2-768x369.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap2-2.jpg 1366w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></li></ul>



<figure class="wp-block-image"><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap3-1-1024x255.jpg" alt="" class="wp-image-1569" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap3-1-1024x255.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap3-1-300x75.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap3-1-768x191.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/cap3-1.jpg 1366w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure>



<p>හරි එහෙනම් අපි දැන් අලුත් project එකක් start කලා angular කියලා..අපි දැන් බලමු හදා ගත්ත project එක run කරන්නේ කොහොමද කියලා..ගොඩක් frame work වල වගේම Angular වලත් තියනවා එයාටම කියලා server එකක්..project එක run කරනවානම් මුලින්ම අපි ng serve හරි npm start හරි ගහලා server එක start කරගෙන ඉන්න ඕනි.ඊට පස්සේ ng -open හරි ng -o හරි ගැහුවහම automatically ඔයාලගේ browser එකේ localhost:4200 කියන port එකේ app එක run වෙනවා..ඔන්න ඔය විදියට app එක run කලාම මෙන්න මේ වගේ view එකක් අපිට බලා ගන්න පුලුවන්.</p>



<ul class="wp-block-gallery columns-1 is-cropped"><li class="blocks-gallery-item"><figure><img src="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-1024x462.jpg" alt="" data-id="1573" data-link="https://danushka96.github.io/sigma/?attachment_id=1573" class="wp-image-1573" srcset="https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-1024x462.jpg 1024w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-300x135.jpg 300w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a-768x347.jpg 768w, https://danushka96.github.io/sigma/wp-content/uploads/2019/01/a.jpg 1351w" sizes="(max-width: 1024px) 100vw, 1024px" /></figure></li></ul>



<p>හරි අදට ඇති නේද😃..පාඩම නම් ටිකක් දිග වුනා තමයි , නමුත් අපි දැන ගත්තා මොකද්ද Angular කියන්නේ, ඇයි Angular විශේෂ වෙනේ ,කොහාමද Angular project එකක් හදා ගන්නේ හා කොහොමද හදා ගත්ත Angular project එක run කරන්නේ කියන එක ගැන..මීලඟ පාඩමේදී අපි බලමු Angular වල folder structure එක සහ index page එක කොහොමද render වුනේ කියන එක ගැන…අදට පාඩම හමාර කරන්නයි යන්නේ..post එක ගැන ඔයාලගේ අදහස comment එකක් දාන්නත් අමතක කරන්න එපා..මීලඟ පාඩමෙන් හමුවනතුරු ඔබට සුභ දවසක්!😊</p>
<p>The post <a rel="nofollow" href="https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/">Angular7 මුල සිට ඉගෙන ගනිමු-1 කොටස</a> appeared first on <a rel="nofollow" href="https://danushka96.github.io/sigma/">The SIGMA</a>.</p>
]]></content:encoded>
							<wfw:commentRss>https://danushka96.github.io/sigma/index.php/2019/01/16/angular7/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
							</item>
	</channel>
</rss>
