<?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>Angular Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/category/angular/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/category/angular/</link>
	<description>Code Solution</description>
	<lastBuildDate>Sat, 03 Jun 2023 03:53:28 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>Angular Archives - Codeplaners</title>
	<link>https://codeplaners.com/category/angular/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Angular 16 install Bootstrap 5 Example</title>
		<link>https://codeplaners.com/angular-16-install-bootstrap-5-example/</link>
					<comments>https://codeplaners.com/angular-16-install-bootstrap-5-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 03 Jun 2023 03:51:26 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 16]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1550</guid>

					<description><![CDATA[<p>Hi dev, Today, i show you angular 16 install bootstrap 5 example. This article will give you simple angular 16 install bootstrap 5 example. you will angular 16 install bootstrap 5 example. In this article, we will implement a angular 16 install bootstrap 5 example. So, let’s follow few steps to create example of angular &#8230; <a href="https://codeplaners.com/angular-16-install-bootstrap-5-example/" class="more-link">Continue reading<span class="screen-reader-text"> "Angular 16 install Bootstrap 5 Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/angular-16-install-bootstrap-5-example/">Angular 16 install Bootstrap 5 Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi dev,</p>
<p>Today, i show you angular 16 install bootstrap 5 example. This article will give you simple angular 16 install bootstrap 5 example. you will angular 16 install bootstrap 5 example. In this article, we will implement a angular 16 install bootstrap 5 example. </p>
<p>So, let’s follow few steps to create example of angular 16 install bootstrap 5 example.</p>
<h3 class="step_code">Step 1: Angular 16 Install</h3>
<p><strong>Follow This Command And Install Angular 16</strong></p>
<pre class="brush: php; title: ; notranslate">
ng new my-new-app
</pre>
<h3 class="step_code">Step 2: Example 1</h3>
<p>install bootstrap on your angular 16 and import css file to style.css file. this is only for css importing. so you can run command bellow:</p>
<pre class="brush: php; title: ; notranslate">
npm install bootstrap --save
</pre>
<p>After that, we need to install the font awesome library using the below npm command</p>
<pre class="brush: php; title: ; notranslate">
npm install font-awesome --save
</pre>
<p>import your bootstrap css on style.css file as like bellow:<br />
<strong>src/style.css</strong></p>
<pre class="brush: php; title: ; notranslate">
@import &quot;~bootstrap/dist/css/bootstrap.css&quot;;
</pre>
<h3 class="step_code">Step 3: Example 2</h3>
<p>We will also install bootstrap along with jquery and popper js. so that you can import bootstrap css and bootstrap js functions as well. So i think this will be the best solution for you i think.<br />
<strong>let&#8217;s run following commands:</strong></p>
<pre class="brush: php; title: ; notranslate">
npm install bootstrap --save
</pre>
<pre class="brush: php; title: ; notranslate">
npm install jquery --save
</pre>
<pre class="brush: php; title: ; notranslate">
npm install popper.js --save
</pre>
<p>Now after running above command successfully. Let&#8217;s import it in the Angular.json file.<br />
<strong>angular.json</strong></p>
<pre class="brush: php; title: ; notranslate">
&quot;styles&quot;: &#x5B;
        &quot;node_modules/bootstrap/dist/css/bootstrap.min.css&quot;,
        &quot;src/styles.css&quot;
      ],
      &quot;scripts&quot;: &#x5B;
          &quot;node_modules/jquery/dist/jquery.min.js&quot;,
          &quot;node_modules/bootstrap/dist/js/bootstrap.min.js&quot;
      ]
</pre>
<p><strong>src/app/app.component.html</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
  &lt;h1&gt;Angular 16 install Bootstrap 5 Example&lt;/h1&gt;
  
  &lt;div class=&quot;card&quot;&gt;
    &lt;div class=&quot;card-header&quot;&gt;
      Featured
    &lt;/div&gt;
    &lt;div class=&quot;card-body&quot;&gt;
      &lt;h5 class=&quot;card-title&quot;&gt;Special title treatment&lt;/h5&gt;
      &lt;p class=&quot;card-text&quot;&gt;With supporting text below as a natural lead-in to additional content.&lt;/p&gt;
      &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Go somewhere&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>
<h3 class="step_code">Run Angular App:</h3>
<p>We have now completed all the steps, now you need to type the below command and press enter to run the Angular app:</p>
<pre class="brush: php; title: ; notranslate">
ng serve
</pre>
<p>Now, go to your web browser, type the given URL and see the app output:</p>
<pre class="brush: php; title: ; notranslate">
http://localhost:4200
</pre>
<p>I hope it will assist you…</p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/angular-16-install-bootstrap-5-example/">Angular 16 install Bootstrap 5 Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/angular-16-install-bootstrap-5-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Update Angular 15 to Angular 16?</title>
		<link>https://codeplaners.com/how-to-update-angular-15-to-angular-16/</link>
					<comments>https://codeplaners.com/how-to-update-angular-15-to-angular-16/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 31 May 2023 05:11:50 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[angular 15 to angular 16]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1540</guid>

					<description><![CDATA[<p>Hi dev, Today, i show you update angular 15 to angular 16. This article will give you simple example of update angular 15 to angular 16. you will update angular 15 to angular 16. In this article, we will implement a update angular 15 to angular 16. So, let’s follow few steps to create example &#8230; <a href="https://codeplaners.com/how-to-update-angular-15-to-angular-16/" class="more-link">Continue reading<span class="screen-reader-text"> "How to Update Angular 15 to Angular 16?"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-update-angular-15-to-angular-16/">How to Update Angular 15 to Angular 16?</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi dev,</p>
<p>Today, i show you update angular 15 to angular 16. This article will give you simple example of update angular 15 to angular 16. you will update angular 15 to angular 16. In this article, we will implement a update angular 15 to angular 16. </p>
<p>So, let’s follow few steps to create example of update angular 15 to angular 16.</p>
<h3 class="step_code"> Update Angular CLI:</h3>
<p><strong>you may instantly upgrade all instances of the angular CLI. To do this, run the following line.</strong></p>
<pre class="brush: php; title: ; notranslate">
ng update @angular/cli @angular/core
</pre>
<p>Now you can see ng version by following command:</p>
<pre class="brush: php; title: ; notranslate">
ng version
</pre>
<h3 class="step_code">Update Angular CLI using reinstall:</h3>
<p>I&#8217;ll provide you a list of commands to use to upgrade from Angular 15 to Angular 16 utilising the uninstall and upgrade functions.<br />
<strong>Uninstall Angular CLI:</strong></p>
<pre class="brush: php; title: ; notranslate">
npm uninstall -g @angular/cli
</pre>
<p><strong>Clear Cache:</strong></p>
<pre class="brush: php; title: ; notranslate">
npm cache clean --force
  
npm cache verify
</pre>
<p><strong>Install Angular CLI:</strong></p>
<pre class="brush: php; title: ; notranslate">
npm install -g @angular/cli
</pre>
<p>Check new version of angular. following command:</p>
<pre class="brush: php; title: ; notranslate">
ng version
</pre>
<p>I hope it will assist you…</p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-update-angular-15-to-angular-16/">How to Update Angular 15 to Angular 16?</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-update-angular-15-to-angular-16/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Angular HTML Content Tooltip Example</title>
		<link>https://codeplaners.com/angular-html-content-tooltip-example/</link>
					<comments>https://codeplaners.com/angular-html-content-tooltip-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 04 Aug 2021 23:53:39 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 11]]></category>
		<category><![CDATA[Angular 12]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1153</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you angular html content tooltip example. This article will implement a angular 12 tooltip with html content. step by step explain angular 12 tooltip with html content. Sometime we&#8217;d like to feature tooltip with HTML content as a result of we&#8217;d like to show thereforeme text as daring &#8230; <a href="https://codeplaners.com/angular-html-content-tooltip-example/" class="more-link">Continue reading<span class="screen-reader-text"> "Angular HTML Content Tooltip Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/angular-html-content-tooltip-example/">Angular HTML Content Tooltip Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you angular html content tooltip example. This article will implement a angular 12 tooltip with html content. step by step explain angular 12 tooltip with html content.</p>
<p>Sometime we&#8217;d like to feature tooltip with HTML content as a result of we&#8217;d like to show thereforeme text as daring or as title so, here we are going to use npm ng2-tooltip-directive package for adding tooltip with HTML content.you can use this example with in angular 6, angular 7, angular 8, angular 9, angular 10, angular 11 and angular 12 version app.</p>
<p>So let’s follow few step to create example of angular html content tooltip example.</p>
<h3>Step 1: Install New App</h3>
<p>You can easily install angular app using bellow command:</p>
<pre class="brush: jscript; title: ; notranslate">
ng new myNewApp
</pre>
<h3>Step 2: Install ng2-tooltip-directive npm Package</h3>
<p>we need to just install ng2-tooltip-directive in our angular app. so let&#8217;s using bellow command:</p>
<pre class="brush: jscript; title: ; notranslate">
npm i ng2-tooltip-directive
</pre>
<h3>Step 3: Import TooltipModule</h3>
<p>import TooltipModule module as like below code:<br />
<strong>src/app/app.module.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
  
import { AppComponent } from './app.component';
import { TooltipModule } from 'ng2-tooltip-directive';
  
@NgModule({
  declarations: &#x5B;
    AppComponent
  ],
  imports: &#x5B;
    BrowserModule,
    TooltipModule
  ],
  providers: &#x5B;],
  bootstrap: &#x5B;AppComponent]
})
export class AppModule { }
</pre>
<h3>Step 4: Update Component Html File</h3>
<p>we need to update Component html file as like below code:<br />
<strong>src/app/app.component.html</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;h1&gt;Angular HTML Content Tooltip Example&lt;/h1&gt;
  
&lt;button placement=&quot;top&quot; tooltip=&quot;&lt;p&gt;Hello i'm a &lt;strong&gt;bold&lt;/strong&gt; text!&lt;/p&gt;&quot;&gt;
  Ex 1: Tooltip with HTML content
&lt;/button&gt;
  
&lt;ng-template #HtmlContent&gt;
  &lt;p&gt;Hello i'm a &lt;strong&gt;bold&lt;/strong&gt; text!&lt;/p&gt;
&lt;/ng-template&gt;
  
&lt;button &#x5B;tooltip]=&quot;HtmlContent&quot; contentType=&quot;template&quot;&gt;
  Ex 2: Tooltip with template content
&lt;/button&gt;
</pre>
<p>run your app by below command</p>
<pre class="brush: jscript; title: ; notranslate">
ng serve
</pre>
<p>I hope it will assist you&#8230;</p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/angular-html-content-tooltip-example/">Angular HTML Content Tooltip Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/angular-html-content-tooltip-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Create Angular 12 CRUD Example</title>
		<link>https://codeplaners.com/how-to-create-angular-12-crud-example/</link>
					<comments>https://codeplaners.com/how-to-create-angular-12-crud-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 15 Jun 2021 00:28:48 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 11]]></category>
		<category><![CDATA[Angular 12]]></category>
		<category><![CDATA[Bootstrap 5]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=997</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you how to create angular 12 CRUD example. This article will give you simple example of how to create angular 12 CRUD example. you will learn how to create angular 12 CRUD example. As you know, angular 12 is released few months back. angular 12 provide more feature &#8230; <a href="https://codeplaners.com/how-to-create-angular-12-crud-example/" class="more-link">Continue reading<span class="screen-reader-text"> "How to Create Angular 12 CRUD Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-create-angular-12-crud-example/">How to Create Angular 12 CRUD Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you how to create angular 12 CRUD example. This article will give you simple example of how to create angular 12 CRUD example. you will learn how to create angular 12 CRUD example. </p>
<p>As you know, angular 12 is released few months back. angular 12 provide more feature and improvements. We will help you in making seven crude operations of angular 12 in this post. So let&#8217;s follow few step to create example of how to create angular 12 CRUD example.</p>
<h3>Step 1:- Create New Angular App</h3>
<p>First of, open your terminal and  install new angular app:</p>
<pre class="brush: jscript; title: ; notranslate">
ng new my-crud-app --routing
</pre>
<h3>Step 2:- Install Bootstrap</h3>
<pre class="brush: jscript; title: ; notranslate">
npm install bootstrap --save
</pre>
<p>import css file as like bellow<br />
<strong>src/styles.css</strong></p>
<pre class="brush: css; title: ; notranslate">
/* You can add global styles to this file, and also import other style files */
@import &quot;~bootstrap/dist/css/bootstrap.css&quot;;
</pre>
<h3>Step 3:- Create Post Module</h3>
<p>follow command and create post module</p>
<pre class="brush: jscript; title: ; notranslate">
ng generate module post --routing
</pre>
<p>successfully run command and create files:</p>
<pre class="brush: jscript; title: ; notranslate">
src/app/post/post.module.ts
src/app/post/post-routing.module.ts
</pre>
<h3>Step 4:- Create Component For Module</h3>
<p>add new component to our post module using bellow command, so let&#8217;s create index, view, create and edit component for admin module:</p>
<pre class="brush: jscript; title: ; notranslate">
ng generate component post/index
ng generate component post/view
ng generate component post/create
ng generate component post/edit
</pre>
<p>successfully run command and create folder with files:</p>
<pre class="brush: jscript; title: ; notranslate">
src/app/post/index/*
src/app/post/view/*
src/app/post/create/*
src/app/post/edit/*
</pre>
<h3>Step 5:- Create Route</h3>
<p>In this step, we will simply create route for index, create, edit and view using generated new component. so we have to update our post-routing module file.</p>
<p><strong>src/app/post/post-routing.module.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { IndexComponent } from './index/index.component';
import { ViewComponent } from './view/view.component';
import { CreateComponent } from './create/create.component';
import { EditComponent } from './edit/edit.component';
  
const routes: Routes = &#x5B;
  { path: 'post', redirectTo: 'post/index', pathMatch: 'full'},
  { path: 'post/index', component: IndexComponent },
  { path: 'post/:postId/view', component: ViewComponent },
  { path: 'post/create', component: CreateComponent },
  { path: 'post/:postId/edit', component: EditComponent } 
];
  
@NgModule({
  imports: &#x5B;RouterModule.forChild(routes)],
  exports: &#x5B;RouterModule]
})
export class PostRoutingModule { }
</pre>
<h3>Step 6:- Create Interface</h3>
<p>in this step, we will create interface using angular command for post module.</p>
<pre class="brush: jscript; title: ; notranslate">
ng generate interface post/post
</pre>
<p><strong>src/app/post/post.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
export interface Post {
    id: number;
    title: string;
    body: string;
}
</pre>
<h3>Step 7:- Create Services</h3>
<p>Here, we will create post service file and we will write and call all web services. we will create getAll(), create(), find(), update() and delete().</p>
<p>we are using <a href="https://jsonplaceholder.typicode.com/" target="_blank" rel="noopener noreferrer">https://jsonplaceholder.typicode.com</a> web site api for now. </p>
<p>create post service and put all code for web service method.</p>
<pre class="brush: jscript; title: ; notranslate">
ng generate service post/post
</pre>
<p><strong>src/app/post/post.service.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders } from '@angular/common/http';
   
import {  Observable, throwError } from 'rxjs';
import { catchError } from 'rxjs/operators';
    
import { Post } from './post';
     
@Injectable({
  providedIn: 'root'
})
export class PostService {
     
  private apiURL = &quot;https://jsonplaceholder.typicode.com&quot;;
     
  httpOptions = {
    headers: new HttpHeaders({
      'Content-Type': 'application/json'
    })
  }
   
  constructor(private httpClient: HttpClient) { }
     
  getAll(): Observable {

    return this.httpClient.get(this.apiURL + '/posts/')

    .pipe(
      catchError(this.errorHandler)
    )
  }
     
  create(post:Post): Observable {

    return this.httpClient.post(this.apiURL + '/posts/', JSON.stringify(post), this.httpOptions)

    .pipe(
      catchError(this.errorHandler)
    )
  }  
     
  find(id:number): Observable {

    return this.httpClient.get(this.apiURL + '/posts/' + id)

    .pipe(
      catchError(this.errorHandler)
    )
  }
     
  update(id:number, post:Post): Observable {

    return this.httpClient.put(this.apiURL + '/posts/' + id, JSON.stringify(post), this.httpOptions)

    .pipe(
      catchError(this.errorHandler)
    )
  }
     
  delete(id:number){
    return this.httpClient.delete(this.apiURL + '/posts/' + id, this.httpOptions)

    .pipe(
      catchError(this.errorHandler)
    )
  }
    
    
  errorHandler(error:any) {
    let errorMessage = '';
    if(error.error instanceof ErrorEvent) {
      errorMessage = error.error.message;
    } else {
      errorMessage = `Error Code: ${error.status}\nMessage: ${error.message}`;
    }
    return throwError(errorMessage);
 }
}
</pre>
<h3>Step 8:- Update Component and Template</h3>
<p>see one by one:</p>
<p><strong>1:- List Page Template and Component</strong><br />
<strong>src/app/post/index/index.component.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { Component, OnInit } from '@angular/core';
import { PostService } from '../post.service';
import { Post } from '../post';
    
@Component({
  selector: 'app-index',
  templateUrl: './index.component.html',
  styleUrls: &#x5B;'./index.component.css']
})
export class IndexComponent implements OnInit {
     
  posts: Post&#x5B;] = &#x5B;];
   
  constructor(public postService: PostService) { }
    
  ngOnInit(): void {
    this.postService.getAll().subscribe((data: Post&#x5B;])=&gt;{
      this.posts = data;
      console.log(this.posts);
    })  
  }
    
  deletePost(id:number){
    this.postService.delete(id).subscribe(res =&gt; {
         this.posts = this.posts.filter(item =&gt; item.id !== id);
         console.log('Post deleted successfully!');
    })
  }
  
}
</pre>
<p><strong>src/app/post/index/index.component.html</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
    &lt;h1&gt;How to Create Angular 12 CRUD Example - codeplaners.com&lt;/h1&gt;
  
    &lt;a href=&quot;#&quot; routerLink=&quot;/post/create/&quot; class=&quot;btn btn-success&quot;&gt;Create New Post&lt;/a&gt;
    
    &lt;table class=&quot;table table-bordered&quot;&gt;
      &lt;tr&gt;
        &lt;th&gt;ID&lt;/th&gt;
        &lt;th&gt;Title&lt;/th&gt;
        &lt;th&gt;Body&lt;/th&gt;
        &lt;th width=&quot;220px&quot;&gt;Action&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr *ngFor=&quot;let post of posts&quot;&gt;
        &lt;td&gt;{{ post.id }}&lt;/td&gt;
        &lt;td&gt;{{ post.title }}&lt;/td&gt;
        &lt;td&gt;{{ post.body }}&lt;/td&gt;
        &lt;td&gt;
          &lt;a href=&quot;#&quot; &#x5B;routerLink]=&quot;&#x5B;'/post/', post.id, 'view']&quot; class=&quot;btn btn-info&quot;&gt;View&lt;/a&gt;
          &lt;a href=&quot;#&quot; &#x5B;routerLink]=&quot;&#x5B;'/post/', post.id, 'edit']&quot; class=&quot;btn btn-primary&quot;&gt;Edit&lt;/a&gt;
          &lt;button type=&quot;button&quot; (click)=&quot;deletePost(post.id)&quot; class=&quot;btn btn-danger&quot;&gt;Delete&lt;/button&gt;
        &lt;/td&gt;
      &lt;/tr&gt;
    &lt;/table&gt;
 &lt;/div&gt;
</pre>
<p><strong>2:- Create Page Template and Component</strong></p>
<p><strong>src/app/post/create/create.component.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { Component, OnInit } from '@angular/core';
import { PostService } from '../post.service';
import { Router } from '@angular/router';
import { FormGroup, FormControl, Validators} from '@angular/forms';
   
@Component({
  selector: 'app-create',
  templateUrl: './create.component.html',
  styleUrls: &#x5B;'./create.component.css']
})
export class CreateComponent implements OnInit {
  
  form: FormGroup;
   
  constructor(
    public postService: PostService,
    private router: Router
  ) { }
  
  ngOnInit(): void {
    this.form = new FormGroup({
      title: new FormControl('', &#x5B;Validators.required]),
      body: new FormControl('', Validators.required)
    });
  }
   
  get f(){
    return this.form.controls;
  }
    
  submit(){
    console.log(this.form.value);
    this.postService.create(this.form.value).subscribe(res =&gt; {
         console.log('Post created successfully!');
         this.router.navigateByUrl('post/index');
    })
  }
  
}
</pre>
<p><strong>src/app/post/create/create.component.html</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
    &lt;h1&gt;Create New Post&lt;/h1&gt;
  
    &lt;a href=&quot;#&quot; routerLink=&quot;/post/index&quot; class=&quot;btn btn-primary&quot;&gt;Back&lt;/a&gt;
        
    &lt;form &#x5B;formGroup]=&quot;form&quot; (ngSubmit)=&quot;submit()&quot;&gt;
  
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;label for=&quot;title&quot;&gt;Title:&lt;/label&gt;
            &lt;input 
                formControlName=&quot;title&quot;
                id=&quot;title&quot; 
                type=&quot;text&quot; 
                class=&quot;form-control&quot;&gt;
            &lt;div *ngIf=&quot;f.title.touched &amp;&amp; f.title.invalid&quot; class=&quot;alert alert-danger&quot;&gt;
                &lt;div *ngIf=&quot;f.title.errors?.required&quot;&gt;Title is required.&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
  
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;label for=&quot;body&quot;&gt;Body&lt;/label&gt;
            &lt;textarea 
                formControlName=&quot;body&quot;
                id=&quot;body&quot; 
                type=&quot;text&quot; 
                class=&quot;form-control&quot;&gt;
            &lt;/textarea&gt;
            &lt;div *ngIf=&quot;f.body.touched &amp;&amp; f.body.invalid&quot; class=&quot;alert alert-danger&quot;&gt;
                &lt;div *ngIf=&quot;f.body.errors?.required&quot;&gt;Body is required.&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
  
        &lt;button class=&quot;btn btn-primary&quot; type=&quot;submit&quot; &#x5B;disabled]=&quot;!form.valid&quot;&gt;Submit&lt;/button&gt;
    &lt;/form&gt;
&lt;/div&gt;
</pre>
<p><strong>3:- Edit Page Template and Component</strong><br />
<strong>src/app/post/edit/edit.component.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { Component, OnInit } from '@angular/core';
import { PostService } from '../post.service';
import { ActivatedRoute, Router } from '@angular/router';
import { Post } from '../post';
import { FormGroup, FormControl, Validators} from '@angular/forms';
   
@Component({
  selector: 'app-edit',
  templateUrl: './edit.component.html',
  styleUrls: &#x5B;'./edit.component.css']
})
export class EditComponent implements OnInit {
    
  id: number;
  post: Post;
  form: FormGroup;
  
  constructor(
    public postService: PostService,
    private route: ActivatedRoute,
    private router: Router
  ) { }
  
  ngOnInit(): void {
    this.id = this.route.snapshot.params&#x5B;'postId'];
    this.postService.find(this.id).subscribe((data: Post)=&gt;{
      this.post = data;
    });
    
    this.form = new FormGroup({
      title: new FormControl('', &#x5B;Validators.required]),
      body: new FormControl('', Validators.required)
    });
  }
   
  get f(){
    return this.form.controls;
  }
     
  submit(){
    console.log(this.form.value);
    this.postService.update(this.id, this.form.value).subscribe(res =&gt; {
         console.log('Post updated successfully!');
         this.router.navigateByUrl('post/index');
    })
  }
   
}
</pre>
<p><strong>src/app/post/edit/edit.component.html</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
    &lt;h1&gt;Update Post&lt;/h1&gt;
  
    &lt;a href=&quot;#&quot; routerLink=&quot;/post/index&quot; class=&quot;btn btn-primary&quot;&gt;Back&lt;/a&gt;
        
    &lt;form &#x5B;formGroup]=&quot;form&quot; (ngSubmit)=&quot;submit()&quot;&gt;
  
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;label for=&quot;title&quot;&gt;Title:&lt;/label&gt;
            &lt;input 
                formControlName=&quot;title&quot;
                id=&quot;title&quot; 
                type=&quot;text&quot; 
                &#x5B;(ngModel)]=&quot;post.title&quot;
                class=&quot;form-control&quot;&gt;
            &lt;div *ngIf=&quot;f.title.touched &amp;&amp; f.title.invalid&quot; class=&quot;alert alert-danger&quot;&gt;
                &lt;div *ngIf=&quot;f.title.errors?.required&quot;&gt;Title is required.&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
         
        &lt;div class=&quot;form-group&quot;&gt;
            &lt;label for=&quot;body&quot;&gt;Body&lt;/label&gt;
            &lt;textarea 
                formControlName=&quot;body&quot;
                id=&quot;body&quot; 
                type=&quot;text&quot; 
                &#x5B;(ngModel)]=&quot;post.body&quot;
                class=&quot;form-control&quot;&gt;
            &lt;/textarea&gt;
            &lt;div *ngIf=&quot;f.body.touched &amp;&amp; f.body.invalid&quot; class=&quot;alert alert-danger&quot;&gt;
                &lt;div *ngIf=&quot;f.body.errors?.required&quot;&gt;Body is required.&lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        
        &lt;button class=&quot;btn btn-primary&quot; type=&quot;submit&quot; &#x5B;disabled]=&quot;!form.valid&quot;&gt;Update&lt;/button&gt;
    &lt;/form&gt;
&lt;/div&gt;
</pre>
<p><strong>4:- Details Page Template and Component</strong><br />
<strong>src/app/post/view/view.component.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { Component, OnInit } from '@angular/core';
import { PostService } from '../post.service';
import { ActivatedRoute, Router } from '@angular/router';
import { Post } from '../post';
  
@Component({
  selector: 'app-view',
  templateUrl: './view.component.html',
  styleUrls: &#x5B;'./view.component.css']
})
export class ViewComponent implements OnInit {
   
  id: number;
  post: Post;
   
  constructor(
    public postService: PostService,
    private route: ActivatedRoute,
    private router: Router
   ) { }
  
  ngOnInit(): void {
    this.id = this.route.snapshot.params&#x5B;'postId'];
      
    this.postService.find(this.id).subscribe((data: Post)=&gt;{
      this.post = data;
    });
  }
  
}
</pre>
<p><strong>src/app/post/view/view.component.html</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
    &lt;h1&gt;View Post&lt;/h1&gt;
  
    &lt;a href=&quot;#&quot; routerLink=&quot;/post/index&quot; class=&quot;btn btn-primary&quot;&gt;Back&lt;/a&gt;
   
    &lt;div&gt;
        &lt;strong&gt;ID:&lt;/strong&gt;
        &lt;p&gt;{{ post.id }}&lt;/p&gt;
    &lt;/div&gt;
   
    &lt;div&gt;
        &lt;strong&gt;Title:&lt;/strong&gt;
        &lt;p&gt;{{ post.title }}&lt;/p&gt;
    &lt;/div&gt;
   
    &lt;div&gt;
        &lt;strong&gt;Body:&lt;/strong&gt;
        &lt;p&gt;{{ post.body }}&lt;/p&gt;
    &lt;/div&gt;
   
&lt;/div&gt;
</pre>
<p>Now let&#8217;s update app html view:<br />
<strong>src/app/app.component.html</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;router-outlet&gt;&lt;/router-outlet&gt;
</pre>
<h3>Step 9:- Import Module File</h3>
<p><strong>src/app/app.module.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
  
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
  
import { PostModule } from './post/post.module';
  
@NgModule({
  declarations: &#x5B;
    AppComponent
  ],
  imports: &#x5B;
    BrowserModule,
    AppRoutingModule,
    PostModule,
    HttpClientModule
  ],
  providers: &#x5B;],
  bootstrap: &#x5B;AppComponent]
})
export class AppModule { }
</pre>
<p><strong>src/app/post/post.module.ts</strong></p>
<pre class="brush: jscript; title: ; notranslate">
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
  
import { PostRoutingModule } from './post-routing.module';
import { IndexComponent } from './index/index.component';
import { ViewComponent } from './view/view.component';
import { CreateComponent } from './create/create.component';
import { EditComponent } from './edit/edit.component';
  
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
  
@NgModule({
  declarations: &#x5B;IndexComponent, ViewComponent, CreateComponent, EditComponent],
  imports: &#x5B;
    CommonModule,
    PostRoutingModule,
    FormsModule,
    ReactiveFormsModule
  ]
})
export class PostModule { }
</pre>
<p>if you have other issues with PropertyInitialization then you can set false as like bellow:</p>
<p><strong>tsconfig.json</strong></p>
<pre class="brush: jscript; title: ; notranslate">
{
  ...
  &quot;angularCompilerOptions&quot;: {
    ...
    &quot;strictPropertyInitialization&quot; : false,
  }
}
</pre>
<p>run our example, you can run by following command:</p>
<pre class="brush: jscript; title: ; notranslate">
ng serve
</pre>
<p><strong>Url:</strong></p>
<pre class="brush: jscript; title: ; notranslate">
localhost:4200/post
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-create-angular-12-crud-example/">How to Create Angular 12 CRUD Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-create-angular-12-crud-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Image Upload Angular 12 Example</title>
		<link>https://codeplaners.com/how-to-image-upload-angular-12-example/</link>
					<comments>https://codeplaners.com/how-to-image-upload-angular-12-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 05 Jun 2021 13:29:26 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 11]]></category>
		<category><![CDATA[Angular 12]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=965</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you how to image upload angular 12 example. This article will give you simple example of how to image upload angular 12 example. you will learn how to image upload angular 12 example. So let&#8217;s follow few step to create example of how to image upload angular 12 &#8230; <a href="https://codeplaners.com/how-to-image-upload-angular-12-example/" class="more-link">Continue reading<span class="screen-reader-text"> "How to Image Upload Angular 12 Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-image-upload-angular-12-example/">How to Image Upload Angular 12 Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you how to image upload angular 12 example. This article will give you simple example of how to image upload angular 12 example. you will learn how to image upload angular 12 example. So let&#8217;s follow few step to create example of how to image upload angular 12 example.</p>
<p><img decoding="async" style="border: 3px solid #ff5722;" src="https://codeplaners.com/wp-content/uploads/2021/06/imageview.png" alt="How to Image Upload Angular 12 Example" ></p>
<h3>Step 1:- Create New Angular App</h3>
<p>First of, open your terminal and  install new angular app:</p>
<pre class="brush: jscript; title: ; notranslate">
ng new my-new-app
</pre>
<h3>Step 2:- Add Code on App.Module.ts File</h3>
<p>Open <strong>src/app</strong> directory and open <strong>app.module.ts</strong> file. And add code into <strong>app.module.ts</strong> file.</p>
<pre class="brush: jscript; title: ; notranslate">
First of, open your terminal and  install new angular app:
&#x5B;code lang=&quot;js&quot;]
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
   
import { AppComponent } from './app.component';
   
@NgModule({
  declarations: &#x5B;
    AppComponent
  ],
  imports: &#x5B;
    BrowserModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule
  ],
  providers: &#x5B;],
  bootstrap: &#x5B;AppComponent]
})
export class AppModule { }
</pre>
<h3>Step 3:- Add Code on View File</h3>
<p>Open <strong>src/app</strong> directory and open <strong>app.component.html</strong> file. And add code into <strong>app.component.html</strong> file.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;h1&gt;How to Image Upload Angular 12 Example&lt;/h1&gt;
   
&lt;form &#x5B;formGroup]=&quot;myForm&quot; (ngSubmit)=&quot;submit()&quot;&gt;
     
    &lt;div class=&quot;form-group&quot;&gt;
        &lt;label for=&quot;name&quot;&gt;Name&lt;/label&gt;
        &lt;input 
            formControlName=&quot;name&quot;
            id=&quot;name&quot; 
            type=&quot;text&quot; 
            class=&quot;form-control&quot;&gt;
        &lt;div *ngIf=&quot;f.name.touched &amp;&amp; f.name.invalid&quot; class=&quot;alert alert-danger&quot;&gt;
            &lt;div *ngIf=&quot;f.name.errors &amp;&amp; f.name.errors.required&quot;&gt;Name is required.&lt;/div&gt;
            &lt;div *ngIf=&quot;f.name.errors &amp;&amp; f.name.errors.minlength&quot;&gt;Name should be 3 character.&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;div class=&quot;form-group&quot;&gt;
        &lt;label for=&quot;file&quot;&gt;File&lt;/label&gt;
        &lt;input 
            formControlName=&quot;file&quot;
            id=&quot;file&quot; 
            type=&quot;file&quot; 
            class=&quot;form-control&quot;
            (change)=&quot;onFileChange($event)&quot;&gt;
        &lt;div *ngIf=&quot;f.file.touched &amp;&amp; f.file.invalid&quot; class=&quot;alert alert-danger&quot;&gt;
            &lt;div *ngIf=&quot;f.file.errors &amp;&amp; f.file.errors.required&quot;&gt;File is required.&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
    
    &lt;img &#x5B;src]=&quot;imageSrc&quot; *ngIf=&quot;imageSrc&quot; style=&quot;height: 300px; width:500px&quot;&gt;
        
    &lt;button class=&quot;btn btn-primary&quot; type=&quot;submit&quot;&gt;Submit&lt;/button&gt;
&lt;/form&gt;
</pre>
<h3>Step 4:- Add Code On app.Component ts File</h3>
<p>Open <strong>src/app</strong> directory and open <strong>app.Component.ts</strong> file. And add code into <strong>app.component.ts</strong> file.</p>
<pre class="brush: jscript; title: ; notranslate">
import { Component } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { FormGroup, FormControl, Validators} from '@angular/forms';
    
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: &#x5B;'./app.component.css']
})
export class AppComponent {
   imageSrc: string = '';
   myForm = new FormGroup({
    name: new FormControl('', &#x5B;Validators.required, Validators.minLength(3)]),
    file: new FormControl('', &#x5B;Validators.required]),
    fileSource: new FormControl('', &#x5B;Validators.required])
  });
  
  constructor(private http: HttpClient) { }
    
  get f(){
    return this.myForm.controls;
  }
   
  onFileChange(event:any) {
    const reader = new FileReader();
    
    if(event.target.files &amp;&amp; event.target.files.length) {
      const &#x5B;file] = event.target.files;
      reader.readAsDataURL(file);
    
      reader.onload = () =&gt; {
   
        this.imageSrc = reader.result as string;
     
        this.myForm.patchValue({
          fileSource: reader.result
        });
   
      };
   
    }
  }
   
  submit(){
    console.log(this.myForm.value);
    this.http.post('http://localhost:8001/upload.php', this.myForm.value)
      .subscribe(res =&gt; {
        console.log(res);
        alert('Uploaded Successfully.');
      })
  }
}
</pre>
<h3>Step 5:- Create upload.php file</h3>
<p>Now we are ready to run example, i we will add api file using php. so you can add upload.php file with &#8220;upload&#8221; folder and run with different port and call it. so let&#8217;s add upload.php file as like bellow:<br />
<strong>upload.php</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;?php
  
    header(&quot;Access-Control-Allow-Origin: *&quot;);
    header(&quot;Access-Control-Allow-Methods: PUT, GET, POST&quot;);
    header(&quot;Access-Control-Allow-Headers: Origin, X-Requested-With, Content-Type, Accept&quot;);
      
    $folderPath = &quot;upload/&quot;;
    $postdata = file_get_contents(&quot;php://input&quot;);
    $request = json_decode($postdata);
      
    $image_parts = explode(&quot;;base64,&quot;, $request-&gt;fileSource);
      
    $image_type_aux = explode(&quot;image/&quot;, $image_parts&#x5B;0]);
      
    $image_type = $image_type_aux&#x5B;1];
      
    $image_base64 = base64_decode($image_parts&#x5B;1]);
      
    $file = $folderPath . uniqid() . '.png';
      
    file_put_contents($file, $image_base64);
  
?&gt;
</pre>
<h3>Step 6:- Run Angular App:</h3>
<pre class="brush: php; title: ; notranslate">
ng serve
</pre>
<h3>Step 7:- Run PHP API</h3>
<pre class="brush: php; title: ; notranslate">
php -S localhost:8001
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-image-upload-angular-12-example/">How to Image Upload Angular 12 Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-image-upload-angular-12-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Phone Number Validation In Angular 12</title>
		<link>https://codeplaners.com/phone-number-validation-in-angular-12/</link>
					<comments>https://codeplaners.com/phone-number-validation-in-angular-12/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 05 Jun 2021 00:28:01 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 11]]></category>
		<category><![CDATA[Angular 12]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=961</guid>

					<description><![CDATA[<p>Hello, I am going to tell you how to add Phone Number Validation in Angular 12, I will give you a simple example for how to add Phone Number Validation in Angular 12. So if you want to use Phone Number Validation for Angular 12, then I will give you a simple example of this. &#8230; <a href="https://codeplaners.com/phone-number-validation-in-angular-12/" class="more-link">Continue reading<span class="screen-reader-text"> "Phone Number Validation In Angular 12"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/phone-number-validation-in-angular-12/">Phone Number Validation In Angular 12</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello,</p>
<p>I am going to tell you how to add Phone Number Validation in Angular 12, I will give you a simple example for how to add Phone Number Validation in Angular 12.  So if you want to use Phone Number Validation for Angular 12, then I will give you a simple example of this. So let&#8217;s follow few step to create example of How to add Phone Number Validation in Angular 12. </p>
<p><img decoding="async" style="border: 3px solid #ff5722;" src="https://codeplaners.com/wp-content/uploads/2021/06/Phone-Number-Validation-In-Angular-12.png" alt="Phone Number Validation In Angular 12" ></p>
<h3>Phone Number Validation Example In Angular 12</h3>
<ul style="list-style: circle;padding: 0 0 0 16px;font-weight: 700;line-height: 26px;font-size: 16px;">
<li>Create New Angular App</li>
<li>Install Bootstrap</li>
<li>Add Code on App.Module.ts File</li>
<li>Add Code on View File</li>
<li>Add Code On app.Component ts File</li>
<li>Run the Angular 12 App</li>
</ul>
<h3>Step 1:- Create New Angular App</h3>
<p>First of, open your terminal and  install new angular app:</p>
<pre class="brush: jscript; title: ; notranslate">
ng new my-new-app
</pre>
<h3>Step 2:- Install Bootstrap</h3>
<p>In this step, following command on your terminal to install bootstrap in angular 12 app.</p>
<pre class="brush: jscript; title: ; notranslate">
npm install --save bootstrap
</pre>
<p>add below code your angular.json file:</p>
<pre class="brush: jscript; title: ; notranslate">
&quot;styles&quot;: &#x5B;
              &quot;src/styles.css&quot;,
              &quot;node_modules/bootstrap/dist/css/bootstrap.min.css&quot;
          ],
&quot;scripts&quot;: &#x5B;&quot;node_modules/bootstrap/dist/js/bootstrap.min.js&quot;]
</pre>
<h3>Step 3:- Add Code on App.Module.ts File</h3>
<p>Open <strong>src/app</strong> directory and open <strong>app.module.ts</strong> file. And add code into <strong>app.module.ts</strong> file.</p>
<pre class="brush: jscript; title: ; notranslate">
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { ReactiveFormsModule } from '@angular/forms';

@NgModule({
  declarations: &#x5B;
    AppComponent
  ],
  imports: &#x5B;
    BrowserModule,
    AppRoutingModule,
	ReactiveFormsModule
  ],
  providers: &#x5B;],
  bootstrap: &#x5B;AppComponent]
})
export class AppModule { }

</pre>
<h3>Step 4:- Add Code on View File</h3>
<p>Open <strong>src/app</strong> directory and open <strong>app.component.html</strong> file. And add code into <strong>app.component.html</strong> file.</p>
<pre class="brush: jscript; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
    &lt;h1&gt;Phone Number Validation In Angular 12 - codeplaners.com&lt;/h1&gt; 
    &lt;form &#x5B;formGroup]=&quot;registerForm&quot; (ngSubmit)=&quot;onSubmit()&quot;&gt;
&lt;div class=&quot;col-md-12&quot;&gt;
    &lt;div class=&quot;form-group&quot;&gt;
        &lt;label for=&quot;&quot;&gt;Your Phone Number &lt;/label&gt;
        &lt;input (keypress)=&quot;keyPress($event)&quot; required type=&quot;text&quot; formControlName=&quot;phonenumber&quot; class=&quot;form-control&quot; placeholder=&quot;Enter Your phone Number&quot; &#x5B;ngClass]=&quot;{ 'is-invalid': submitted &amp;&amp; f.phonenumber.errors }&quot;&gt;
        &lt;div *ngIf=&quot;submitted &amp;&amp; f.phonenumber.errors&quot; class=&quot;invalid-feedback alert alert-danger&quot;&gt;
            &lt;div *ngIf=&quot;f.phonenumber.errors.required&quot;&gt;Phone number is required&lt;/div&gt;
            &lt;div *ngIf=&quot;f.phonenumber.errors.pattern || f.phonenumber.errors.maxlength || f.phonenumber.errors.minlength&quot;&gt;Please, Enter 10 digit Mobile Number.&lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
  
&lt;input type=&quot;submit&quot; class=&quot;btn btn-primary&quot; value=&quot;Submit&quot;&gt;
&lt;/form&gt;
&lt;/div&gt;
</pre>
<h3>Step 5:- Add Code On app.Component ts File</h3>
<p>Open <strong>src/app</strong> directory and open <strong>app.Component.ts</strong> file. And add code into <strong>app.component.ts</strong> file.</p>
<pre class="brush: jscript; title: ; notranslate">
import { Component } from '@angular/core';
import { FormBuilder, FormGroup, FormControl, Validators} from '@angular/forms';
   
@Component({
  selector: 'app-root',
  templateUrl: './app.component.html',
  styleUrls: &#x5B;'./app.component.css']
})
export class AppComponent {
  registerForm: FormGroup = new FormGroup({});
  
  submitted = false;
  constructor(private formBuilder: FormBuilder) { }
  
  
  keyPress(event: any) {
    const pattern = /&#x5B;0-9\+\-\ ]/;
  
    let inputChar = String.fromCharCode(event.charCode);
    if (event.keyCode != 8 &amp;&amp; !pattern.test(inputChar)) {
      event.preventDefault();
    }
  }
  
  ngOnInit() {
    this.registerForm = this.formBuilder.group({
       phonenumber: &#x5B;'', &#x5B; Validators.required,
        Validators.pattern(&quot;^&#x5B;0-9]*$&quot;),
        Validators.minLength(10), Validators.maxLength(10)]]
    });
}
// convenience getter for easy access to form fields
get f() { return this.registerForm.controls; }
onSubmit() {
    this.submitted = true;
    // stop here if form is invalid
    if (this.registerForm.invalid) {
        return;
    }    
}
  
}
</pre>
<h3>Step 6:- Run the Angular 12 App</h3>
<pre class="brush: jscript; title: ; notranslate">
ng serve
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/phone-number-validation-in-angular-12/">Phone Number Validation In Angular 12</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/phone-number-validation-in-angular-12/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Install Bootstrap 5 in Angular 12</title>
		<link>https://codeplaners.com/how-to-install-bootstrap-5-in-angular-12/</link>
					<comments>https://codeplaners.com/how-to-install-bootstrap-5-in-angular-12/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 04 Jun 2021 00:22:51 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 12]]></category>
		<category><![CDATA[Bootstrap 5]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=958</guid>

					<description><![CDATA[<p>Hello, I am going to tell you how to add Bootstrap 5 in Angular 12, I will give you a simple example for how to add Bootstrap 5 in Angular 12. As we know that Bootstrap is the most popular framework of Word. So if you want to use Bootstrap 5 for Angular 12, then &#8230; <a href="https://codeplaners.com/how-to-install-bootstrap-5-in-angular-12/" class="more-link">Continue reading<span class="screen-reader-text"> "How to Install Bootstrap 5 in Angular 12"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-install-bootstrap-5-in-angular-12/">How to Install Bootstrap 5 in Angular 12</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello,</p>
<p>I am going to tell you how to add Bootstrap 5 in Angular 12, I will give you a simple example for how to add Bootstrap 5 in Angular 12. As we know that Bootstrap is the most popular framework of Word. So if you want to use Bootstrap 5 for Angular 12, then I will give you a simple example of this.</p>
<p>I will give you 2 examples how to install Bootstrap in Angular 12. So let&#8217;s follow few step to create example of How to Install Bootstrap 5 in Angular 12. </p>
<p>First of all install your new angular with this command: </p>
<pre class="brush: jscript; title: ; notranslate">
ng new my-new-app
</pre>
<h3>Example 1:</h3>
<p>In this example, all you have to do is install Bootstrap in Angular 12 and add the CSS file. This is only for adding a css file.<br />
then you can run the command below:</p>
<pre class="brush: jscript; title: ; notranslate">
npm install bootstrap --save
</pre>
<p>need to import your bootstrap css on style.css file as like bellow<br />
<strong>src/style.css</strong></p>
<pre class="brush: jscript; title: ; notranslate">
@import &quot;~bootstrap/dist/css/bootstrap.css&quot;;
</pre>
<h3>Example 2:</h3>
<p>In this example, we&#8217;ll be adding Bootstrap with jQuery and popper js. so that you can also import bootstrap css and bootstrap js function.<br />
run following commands:</p>
<pre class="brush: jscript; title: ; notranslate">
npm install bootstrap --save
</pre>
<pre class="brush: jscript; title: ; notranslate">
npm install jquery --save
</pre>
<pre class="brush: jscript; title: ; notranslate">
npm install popper.js --save
</pre>
<p>Now after successfully run above command. let&#8217;s import it in angular.json file.<br />
<strong>angular.json</strong></p>
<pre class="brush: jscript; title: ; notranslate">
&quot;styles&quot;: &#x5B;
        &quot;node_modules/bootstrap/dist/css/bootstrap.min.css&quot;,
        &quot;src/styles.css&quot;
      ],
      &quot;scripts&quot;: &#x5B;
          &quot;node_modules/jquery/dist/jquery.min.js&quot;,
          &quot;node_modules/bootstrap/dist/js/bootstrap.min.js&quot;
      ]
</pre>
<p><strong>src/app/app.component.html </strong></p>
<pre class="brush: jscript; title: ; notranslate">
&lt;div class=&quot;container&quot;&gt;
  &lt;h1&gt;Install Bootstrap 5 in Angular 12 - codeplaners&lt;/h1&gt;
  &lt;div class=&quot;card&quot;&gt;
    &lt;div class=&quot;card-header&quot;&gt;
      Featured
    &lt;/div&gt;
    &lt;div class=&quot;card-body&quot;&gt;
      &lt;h5 class=&quot;card-title&quot;&gt;Special title treatment&lt;/h5&gt;
      &lt;p class=&quot;card-text&quot;&gt;With supporting text below as a natural lead-in to additional content.&lt;/p&gt;
      &lt;a href=&quot;#&quot; class=&quot;btn btn-primary&quot;&gt;Go somewhere&lt;/a&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-install-bootstrap-5-in-angular-12/">How to Install Bootstrap 5 in Angular 12</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-install-bootstrap-5-in-angular-12/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How To Install Angular</title>
		<link>https://codeplaners.com/how-to-install-angular/</link>
					<comments>https://codeplaners.com/how-to-install-angular/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Tue, 25 May 2021 00:28:09 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Angular 11]]></category>
		<category><![CDATA[Install Angular]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=834</guid>

					<description><![CDATA[<p>Hello Dev, Today, i we will show you how to install angular. This article will give you simple example of how to install angular. you will learn how to install angular. So let&#8217;s follow few step to create example of how to install angular. Step 1:- Install Angular Cli npm install -g @angular/cli Step 2:- &#8230; <a href="https://codeplaners.com/how-to-install-angular/" class="more-link">Continue reading<span class="screen-reader-text"> "How To Install Angular"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-install-angular/">How To Install Angular</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hello Dev,</p>
<p>Today, i we will show you how to install angular. This article will give you simple example of how to install angular. you will learn how to install angular. So let&#8217;s follow few step to create example of how to install angular.</p>
<h3>Step 1:- Install Angular Cli</h3>
<pre class="brush: jscript; title: ; notranslate">
npm install -g @angular/cli
</pre>
<h3>Step 2:- Create Angular Project</h3>
<pre class="brush: jscript; title: ; notranslate">
ng new my-app
</pre>
<h3>Step 3:- Run Angular Project</h3>
<pre class="brush: jscript; title: ; notranslate">
cd my-app
ng serve --open
</pre>
<p>automatically opens your browser to <strong>http://localhost:4200/</strong></p>
<p><img decoding="async" style="border: 3px solid #ff5722;" src="https://codeplaners.com/wp-content/uploads/2021/05/Install-Angular-Cli.png" alt="Install Angular" ></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/how-to-install-angular/">How To Install Angular</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/how-to-install-angular/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Bootstrap multiple select with checkboxes example</title>
		<link>https://codeplaners.com/bootstrap-multiple-select-with-checkboxes-example/</link>
					<comments>https://codeplaners.com/bootstrap-multiple-select-with-checkboxes-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Thu, 25 Mar 2021 07:53:20 +0000</pubDate>
				<category><![CDATA[Angular]]></category>
		<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[CakePHP]]></category>
		<category><![CDATA[Codeigniter]]></category>
		<category><![CDATA[HTML&CSS]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Laravel]]></category>
		<category><![CDATA[Node Js]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Reacts]]></category>
		<category><![CDATA[Vue Js]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=540</guid>

					<description><![CDATA[<p>In this article, how to use multiple select dropdown with checkbox that way user can select multiple check boxes using bootstrap-multiselect.js plugin of bootstrap jquery. Bootstrap have a lots of plugin like for datepicker, colorpicker, select with search etc. you can integrate easily with your bootstrap project, even if you are working on code PHP, &#8230; <a href="https://codeplaners.com/bootstrap-multiple-select-with-checkboxes-example/" class="more-link">Continue reading<span class="screen-reader-text"> "Bootstrap multiple select with checkboxes example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/bootstrap-multiple-select-with-checkboxes-example/">Bootstrap multiple select with checkboxes example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>In this article, how to use multiple select dropdown with checkbox that way user can select multiple check boxes using bootstrap-multiselect.js plugin of bootstrap jquery. Bootstrap have a lots of plugin like for datepicker, colorpicker, select with search etc. you can integrate easily with your bootstrap project, even if you are working on code PHP, laravel framework, codeigniter framework, symfony framework or etc other framework of PHP.</p>
<pre class="brush: php; title: ; notranslate">
&lt;html lang=&quot;en&quot;&gt;
&lt;head&gt;
  &lt;title&gt;Bootstrap multiple select with checkboxes example - CodePlaners&lt;/title&gt;
  &lt;!-- Bootstrap CSS --&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&quot;&gt;
  &lt;link rel=&quot;stylesheet&quot; href=&quot;https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/css/bootstrap-multiselect.css&quot;&gt;
&lt;/head&gt;
&lt;body&gt;


&lt;div class=&quot;container&quot;&gt;
	&lt;strong&gt;Select Language:&lt;/strong&gt;
    &lt;select id=&quot;MultipleCheckboxes&quot; multiple=&quot;multiple&quot;&gt;
        &lt;option value=&quot;php&quot;&gt;PHP&lt;/option&gt;
        &lt;option value=&quot;laravel&quot;&gt;Laravel&lt;/option&gt;
        &lt;option value=&quot;java&quot;&gt;Java&lt;/option&gt;
        &lt;option value=&quot;sql&quot;&gt;SQL&lt;/option&gt;
        &lt;option value=&quot;jquery&quot;&gt;Jquery&lt;/option&gt;
    &lt;/select&gt;
&lt;/div&gt;

    &lt;script src=&quot;https://code.jquery.com/jquery-3.2.1.slim.min.js&quot; &gt;&lt;/script&gt;
    &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js&quot; &gt;&lt;/script&gt;
    &lt;script src=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
  	&lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/bootstrap-multiselect/0.9.13/js/bootstrap-multiselect.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		$(function() {
                $('#MultipleCheckboxes').multiselect({
                    enableClickableOptGroups: true,
                    includeSelectAllOption:true,
                    nonSelectedText: 'Select language'
                });
            });
    &lt;/script&gt;


&lt;/body&gt;
&lt;/html&gt;
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/bootstrap-multiple-select-with-checkboxes-example/">Bootstrap multiple select with checkboxes example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/bootstrap-multiple-select-with-checkboxes-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
