{"id":20,"date":"2020-11-05T20:13:06","date_gmt":"2020-11-05T20:13:06","guid":{"rendered":"https:\/\/codecasm.com\/blogs\/?p=20"},"modified":"2022-01-08T03:44:36","modified_gmt":"2022-01-08T03:44:36","slug":"getting-started-with-angular","status":"publish","type":"post","link":"https:\/\/codecasm.com\/blogs\/getting-started-with-angular\/","title":{"rendered":"Getting started with Angular"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\">Pre-requisites \ud83d\ude07<\/h3>\n\n\n\n<p>\ud83d\udc49&nbsp;<strong>node &amp; npm<\/strong>&nbsp;<em>i.e. node package manager<\/em><br>\ud83d\udc49&nbsp;<strong>angular\/cli<\/strong>&nbsp;<em>i.e. command line interface for Angular<\/em><br>\ud83d\udc49&nbsp;<strong>Code editor\/IDE<\/strong>&nbsp;<em>i.e.<\/em>&nbsp;<a href=\"https:\/\/code.visualstudio.com\/download\">VS Code<\/a>,&nbsp;<a href=\"https:\/\/www.sublimetext.com\/3\">Sublime<\/a>&nbsp;or any you prefer<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\ud83e\udd14&nbsp;<em>If you don&#8217;t have these installed in your machine, let&#8217;s quickly get it installed.<\/em><\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; installing&nbsp;<code>node<\/code>&nbsp;&amp;&nbsp;<code>npm<\/code>&nbsp;\ud83d\udc4d<\/h3>\n\n\n\n<ol class=\"wp-block-list\"><li>for&nbsp;<code>Windows<\/code>:<br><a href=\"https:\/\/nodejs.org\/en\/download\/\">download link to node binaries<\/a><\/li><li>for&nbsp;<code>Ubuntu\/Linux<\/code>&nbsp;or&nbsp;<code>MacOS<\/code>:<br><a href=\"https:\/\/nodejs.org\/en\/download\/package-manager\/\">select your OS to get command<\/a><\/li><li>command for installation using package manager through terminal<\/li><\/ol>\n\n\n\n<p><strong>Node.js v14.x<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Using Ubuntu\ncurl -sL https:\/\/deb.nodesource.com\/setup_14.x | sudo -E bash -\nsudo apt-get install -y nodejs<\/code><\/pre>\n\n\n\n<p>Verify with the below commands that&nbsp;<em><code>node<\/code><\/em>&nbsp;and&nbsp;<em><code>npm<\/code><\/em>&nbsp;fire below commands<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Using Ubuntu\nnode -v\nnpm -v<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\">&#8211; Let&#8217;s get your hand dirty \ud83d\udd90\ufe0f<\/h2>\n\n\n\n<p>Now, we have our&nbsp;<code>npm<\/code>&nbsp;<em>(node package manager)<\/em>&nbsp;installed, we can use it to install Angular in our system.<br>Use below command to install&nbsp;<code>Angular CLI<\/code><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>npm install -g @angular\/cli \n\nOR \n\n#for specific version, use below command\nnpm install -g @angular\/cli@6.1.3\n\n#this will install specific version of Angular 6.1.3<\/code><\/pre>\n\n\n\n<p>verify if\u00a0<code>Angular CLI<\/code>\u00a0is installed successfully, fire below command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ng v<\/code><\/pre>\n\n\n\n<p>it must look something like below:<br><a href=\"https:\/\/res.cloudinary.com\/practicaldev\/image\/fetch\/s--x6zTpb9b--\/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880\/https:\/\/dev-to-uploads.s3.amazonaws.com\/i\/wyx0u7gtnnsk1rcui5ne.png\"><\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">&#8211; Now, we will create our first Angular project<\/h2>\n\n\n\n<p>We need to fire below command in our&nbsp;<code>terminal\/command prompt<\/code>&nbsp;to create our project<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ng new angular-app<\/code><\/pre>\n\n\n\n<p>Here,&nbsp;<code>ng new<\/code>&nbsp;is used to create new project and&nbsp;<code>angular-app<\/code>&nbsp;is your Angular project name.<\/p>\n\n\n\n<p>It will create&nbsp;<code>Angular project<\/code>&nbsp;with default template provided by&nbsp;<code>Angular<\/code>&nbsp;itself. To have a quick look on it, we can goto our browser and visit default url served by Angular&nbsp;<em>i.e.&nbsp;<a href=\"http:\/\/localhost:4200\/\">http:\/\/localhost:4200<\/a><\/em><\/p>\n\n\n\n<p>Now, we need to point our&nbsp;<code>terminal<\/code>&nbsp;to Angular project, to achieve this use this command<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cd angular-app<\/code><\/pre>\n\n\n\n<p>As of now, we are in our Angular project folder. We can use below command to serve our application to the browser<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># to just serve and visit http:\/\/localhost:4200\nng serve\n\n# to serve it on it's default browser\nng serve -o<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Wow \ud83e\udd29, we just created an Angular application. It was super easy, isn&#8217;t it.<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">&#8211; Find the helping visuals \ud83c\udfac below here:<\/h3>\n\n\n\n<figure class=\"wp-block-embed is-type-rich is-provider-embed-handler wp-block-embed-embed-handler wp-embed-aspect-16-9 wp-has-aspect-ratio\"><div class=\"wp-block-embed__wrapper\">\n<iframe loading=\"lazy\" title=\"Getting started with Angular and setting up the environment | CodeCasm\" width=\"640\" height=\"360\" src=\"https:\/\/www.youtube.com\/embed\/XoeJINGrqgc?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe>\n<\/div><\/figure>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-text-align-center\">We are open for contribution \ud83e\udd1d&nbsp;<a href=\"https:\/\/codecasm.com\/\">CodeCasm<\/a><\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n\n\n\n<p class=\"has-text-align-center\">\u2764\ufe0f Happy coding \u2764\ufe0f<\/p>\n\n\n\n<hr class=\"wp-block-separator\"\/>\n","protected":false},"excerpt":{"rendered":"<p>Pre-requisites \ud83d\ude07 \ud83d\udc49&nbsp;node &amp; npm&nbsp;i.e. node package manager\ud83d\udc49&nbsp;angular\/cli&nbsp;i.e. command line interface for Angular\ud83d\udc49&nbsp;Code editor\/IDE&nbsp;i.e.&nbsp;VS Code,&nbsp;Sublime&nbsp;or any you prefer \ud83e\udd14&nbsp;If you don&#8217;t have these installed in your machine, let&#8217;s quickly get it installed. &#8211; installing&nbsp;node&nbsp;&amp;&nbsp;npm&nbsp;\ud83d\udc4d for&nbsp;Windows:download link to node binaries for&nbsp;Ubuntu\/Linux&nbsp;or&nbsp;MacOS:select your OS to get command command for installation using package manager through terminal Node.js v14.x: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":22,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[2,4,10,3],"tags":[6,7,9,12,8],"class_list":["post-20","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-angular","category-javascript","category-ngpune","category-typescript","tag-angular","tag-codecasm","tag-javascript","tag-ngpune","tag-typescript"],"jetpack_featured_media_url":"https:\/\/i0.wp.com\/codecasm.com\/blogs\/wp-content\/uploads\/2020\/11\/getting-started-with-angular.png?fit=1000%2C420&ssl=1","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/posts\/20","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/comments?post=20"}],"version-history":[{"count":3,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/posts\/20\/revisions"}],"predecessor-version":[{"id":135,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/posts\/20\/revisions\/135"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/media\/22"}],"wp:attachment":[{"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/media?parent=20"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/categories?post=20"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codecasm.com\/blogs\/wp-json\/wp\/v2\/tags?post=20"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}