<?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>Bootstrap 5 Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/bootstrap-5/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/bootstrap-5/</link>
	<description>Code Solution</description>
	<lastBuildDate>Wed, 23 Jun 2021 00:18:44 +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>Bootstrap 5 Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/bootstrap-5/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Bootstrap drag and drop using jquery UI sortable</title>
		<link>https://codeplaners.com/bootstrap-drag-and-drop-using-jquery-ui-sortable/</link>
					<comments>https://codeplaners.com/bootstrap-drag-and-drop-using-jquery-ui-sortable/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Wed, 23 Jun 2021 00:17:59 +0000</pubDate>
				<category><![CDATA[Bootstrap]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Jquery Ui]]></category>
		<category><![CDATA[bootstrap 4]]></category>
		<category><![CDATA[Bootstrap 5]]></category>
		<category><![CDATA[drag and drop]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1018</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you Bootstrap drag and drop using jquery UI sortable. This article will give you simple example of Bootstrap drag and drop using jquery UI sortable. you will learn Bootstrap drag and drop using jquery UI sortable. So let&#8217;s follow few step to create example of Bootstrap drag and &#8230; <a href="https://codeplaners.com/bootstrap-drag-and-drop-using-jquery-ui-sortable/" class="more-link">Continue reading<span class="screen-reader-text"> "Bootstrap drag and drop using jquery UI sortable"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/bootstrap-drag-and-drop-using-jquery-ui-sortable/">Bootstrap drag and drop using jquery UI sortable</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 Bootstrap drag and drop using jquery UI sortable. This article will give you simple example of Bootstrap drag and drop using jquery UI sortable. you will learn Bootstrap drag and drop using jquery UI sortable. So let&#8217;s follow few step to create example of Bootstrap drag and drop using jquery UI sortable.</p>
<p>Preview:<br />
<img decoding="async" style="border: 3px solid #ff5722;" alt="Bootstrap drag and drop using jquery UI sortable"  src="https://codeplaners.com/wp-content/uploads/2021/06/darg-and-drop.png"></p>
<p><strong>Example</strong></p>
<pre class="brush: xml; title: ; notranslate">
&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;title&gt;Bootstrap Sort list by drag and drop using jquery UI sortable - Codeplaners.com&lt;/title&gt;
&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1&quot;&gt;
&lt;link href=&quot;https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css&quot; rel=&quot;stylesheet&quot;&gt;
&lt;script src=&quot;https://stackpath.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.bundle.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;https://code.jquery.com/jquery-1.12.4.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;https://code.jquery.com/ui/1.12.1/jquery-ui.js&quot;&gt;&lt;/script&gt;
&lt;script&gt;
    $(function() {
        $(&quot;#sortable&quot;).sortable();
        $(&quot;#sortable&quot;).disableSelection();
    });
&lt;/script&gt;

&lt;body&gt;

&lt;div class=&quot;page-content page-container&quot; id=&quot;page-content&quot;&gt;
    &lt;div class=&quot;container&quot;&gt;
        &lt;div class=&quot;row&quot;&gt;
            &lt;div class=&quot;col-sm-12&quot;&gt;
                &lt;div class=&quot;container-fluid d-flex justify-content-center&quot;&gt;
                    &lt;div class=&quot;list list-row card&quot; id=&quot;sortable&quot; data-sortable-id=&quot;0&quot; aria-dropeffect=&quot;move&quot;&gt;
                        &lt;div class=&quot;list-item&quot; data-id=&quot;13&quot; data-item-sortable-id=&quot;0&quot; draggable=&quot;true&quot; role=&quot;option&quot; aria-grabbed=&quot;false&quot; style=&quot;&quot;&gt;
                            &lt;div&gt;&lt;a href=&quot;#&quot; data-abc=&quot;true&quot;&gt;&lt;span class=&quot;w-40 avatar gd-primary&quot;&gt;C&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
                            &lt;div class=&quot;flex&quot;&gt; &lt;a href=&quot;#&quot; class=&quot;item-author text-color&quot; data-abc=&quot;true&quot;&gt;Patrick Linod&lt;/a&gt;
                                &lt;div class=&quot;item-except text-muted text-sm h-1x&quot;&gt;For what reason would it be advisable for me to think about business content?&lt;/div&gt;
                            &lt;/div&gt;
                            &lt;div class=&quot;no-wrap&quot;&gt;
                                &lt;div class=&quot;item-date text-muted text-sm d-none d-md-block&quot;&gt;1 weeks ago&lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class=&quot;list-item&quot; data-id=&quot;9&quot; data-item-sortable-id=&quot;0&quot; draggable=&quot;true&quot; role=&quot;option&quot; aria-grabbed=&quot;false&quot;&gt;
                            &lt;div&gt;&lt;a href=&quot;#&quot; data-abc=&quot;true&quot;&gt;&lt;span class=&quot;w-40 avatar gd-info&quot;&gt;&lt;img src=&quot;https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-192x192.png&quot; alt=&quot;.&quot;&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
                            &lt;div class=&quot;flex&quot;&gt; &lt;a href=&quot;#&quot; class=&quot;item-author text-color&quot; data-abc=&quot;true&quot;&gt;Steven Hmpire&lt;/a&gt;
                                &lt;div class=&quot;item-except text-muted text-sm h-1x&quot;&gt;Build a progressive web app using jQuery&lt;/div&gt;
                            &lt;/div&gt;
                            &lt;div class=&quot;no-wrap&quot;&gt;
                                &lt;div class=&quot;item-date text-muted text-sm d-none d-md-block&quot;&gt;10 days ago&lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;div class=&quot;list-item&quot; data-id=&quot;17&quot; data-item-sortable-id=&quot;0&quot; draggable=&quot;true&quot; role=&quot;option&quot; aria-grabbed=&quot;false&quot; style=&quot;&quot;&gt;
                            &lt;div&gt;&lt;a href=&quot;#&quot; data-abc=&quot;true&quot;&gt;&lt;span class=&quot;w-40 avatar gd-warning&quot;&gt;M&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
                            &lt;div class=&quot;flex&quot;&gt; &lt;a href=&quot;#&quot; class=&quot;item-author text-color&quot; data-abc=&quot;true&quot;&gt;Alan musk&lt;/a&gt;
                                &lt;div class=&quot;item-except text-muted text-sm h-1x&quot;&gt;it be advisable for me to think about business content?&lt;/div&gt;
                            &lt;/div&gt;
                            &lt;div class=&quot;no-wrap&quot;&gt;
                                &lt;div class=&quot;item-date text-muted text-sm d-none d-md-block&quot;&gt;13/12 18&lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/div&gt;
&lt;style&gt;
body {
     background-color: #f9f9fa
}
.card {
     background: #faf7f7;
     border-width: 0;
     border-radius: .25rem;
     box-shadow: 0 1px 3px rgba(0, 0, 0, .05);
     margin-bottom: 1.5rem;
	 margin: 50px 0 0;
     position: relative;
     display: flex;
     flex-direction: column;
     min-width: 0;
     word-wrap: break-word;
     background-clip: border-box;
     border: 1px solid rgba(19, 24, 44, .125);
     border-radius: .25rem
}
.list-item.block .media {
 border-bottom-left-radius: 0;
 border-bottom-right-radius: 0
}
.list-item.block .list-content {
 padding: 1rem
}

.w-40 {
 width: 40px !important;
 height: 40px !important
}
.avatar {
	 position: relative;
	 line-height: 1;
	 border-radius: 500px;
	 white-space: nowrap;
	 font-weight: 700;
	 border-radius: 100%;
	 display: -ms-flexbox;
	 display: flex;
	 -ms-flex-pack: center;
	 justify-content: center;
	 -ms-flex-align: center;
	 align-items: center;
	 -ms-flex-negative: 0;
	 flex-shrink: 0;
	 border-radius: 500px;
	 box-shadow: 0 5px 10px 0 rgba(50, 50, 50, .15)
}

.avatar img {
	 border-radius: inherit;
	 width: 100%
}
.gd-primary {
	 color: #fff;
	 border: none;
	 background: #448bff linear-gradient(45deg, #448bff, #44e9ff)
}
.flex {
	 -webkit-box-flex: 1;
	 -ms-flex: 1 1 auto;
	 flex: 1 1 auto
}
.text-color {
 	color: #5e676f
}

.text-sm {
 	font-size: .825rem
}
.h-1x {
	 height: 1.25rem;
	 overflow: hidden;
	 display: -webkit-box;
	 -webkit-line-clamp: 1;
	 -webkit-box-orient: vertical
}

.no-wrap {
 	white-space: nowrap
}

.list-row .list-item {
	 -ms-flex-direction: row;
	 flex-direction: row;
	 -ms-flex-align: center;
	 align-items: center;
	 padding: .75rem .625rem
}

.list-item {
	 position: relative;
	 display: -ms-flexbox;
	 display: flex;
	 -ms-flex-direction: column;
	 flex-direction: column;
	 min-width: 0;
	 word-wrap: break-word
}
.list-row .list-item&gt;* {
 padding-left: .625rem;
 padding-right: .625rem
}
a:focus,
a:hover {
 text-decoration: none
}
list-item {
 background: white
}
&lt;/style&gt;


&lt;/body&gt;
&lt;/html&gt;

</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/bootstrap-drag-and-drop-using-jquery-ui-sortable/">Bootstrap drag and drop using jquery UI sortable</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/bootstrap-drag-and-drop-using-jquery-ui-sortable/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 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>
	</channel>
</rss>
