Categories

Sunday, December 22, 2024
#919814419350 therichposts@gmail.com
Angular 11Bootstrap 4

Angular 11 Bootstrap 4 Credit Card Form Working Demo

Angular 11 Bootstrap 4 Credit Card Form Working Demo

Hello friends, welcome back to my blog. Today in this blog post, I am going to tell you, Angular 11 Bootstrap 4 Credit Card Form Working Demo.

Angular Credit Card Form

Angular 11 came and if you are new then you must check below two links:

  1. Angular11 Basic Tutorials

Friends now I proceed onwards and here is the working code snippet for Angular 11 Bootstrap 4 Credit Card Form Working Demo and please use carefully this to avoid the mistakes:

1. Firstly friends we need fresh angular 11 setup and for this we need to run below commands but if you already have angular 11 setup then you can avoid below commands. Secondly we should also have latest node version installed on our system:

npm install -g @angular/cli 

ng new angularbootstrap //Create new Angular Project

cd angularbootstrap // Go inside the Angular Project Folder

ng serve --open // Run and Open the Angular Project

http://localhost:4200/ // Working Angular Project Url

 

2. Now friends, here we need to run below commands into our project terminal to install bootstrap and jquery modules into our angular application:

npm install --save bootstrap

npm i jquery --save

 

3. Now friends, here we need to add below  into our angular.json file:

...
 "styles": [
              ...
              "node_modules/bootstrap/dist/css/bootstrap.min.css"
             
              
            ],
            "scripts": [
              "node_modules/jquery/dist/jquery.min.js", 
              
              "node_modules/bootstrap/dist/js/bootstrap.min.js"
       
              
              
            ]
...

 

4. Now friends we just need to add below code into src/app/app.component.html file to get final out on the web browser:

<div class="container py-5">
  
    <div class="row">
      <div class="col-lg-7 mx-auto">
        <div class="bg-white rounded-lg shadow-sm p-5">
          <!-- Credit card form tabs -->
          <ul role="tablist" class="nav bg-light nav-pills rounded-pill nav-fill mb-3">
            <li class="nav-item">
              <a data-toggle="pill" href="#nav-tab-card" class="nav-link active rounded-pill">
                                  <i class="fa fa-credit-card"></i>
                                  Credit Card
                              </a>
            </li>
            <li class="nav-item">
              <a data-toggle="pill" href="#nav-tab-paypal" class="nav-link rounded-pill">
                                  <i class="fa fa-paypal"></i>
                                  Paypal
                              </a>
            </li>
            <li class="nav-item">
              <a data-toggle="pill" href="#nav-tab-bank" class="nav-link rounded-pill">
                                  <i class="fa fa-university"></i>
                                   Bank Transfer
                               </a>
            </li>
          </ul>
          <!-- End -->
  
  
          <!-- Credit card form content -->
          <div class="tab-content">
  
            <!-- credit card info-->
            <div id="nav-tab-card" class="tab-pane fade show active">
              <p class="alert alert-success">Some text success or error</p>
              <form role="form">
                <div class="form-group">
                  <label for="username">Full name (on the card)</label>
                  <input type="text" name="username" placeholder="Jason Doe" required class="form-control">
                </div>
                <div class="form-group">
                  <label for="cardNumber">Card number</label>
                  <div class="input-group">
                    <input type="text" name="cardNumber" placeholder="Your card number" class="form-control" required>
                    <div class="input-group-append">
                      <span class="input-group-text text-muted">
                                                  <i class="fa fa-cc-visa mx-1"></i>
                                                  <i class="fa fa-cc-amex mx-1"></i>
                                                  <i class="fa fa-cc-mastercard mx-1"></i>
                                              </span>
                    </div>
                  </div>
                </div>
                <div class="row">
                  <div class="col-sm-8">
                    <div class="form-group">
                      <label><span class="hidden-xs">Expiration</span></label>
                      <div class="input-group">
                        <input type="number" placeholder="MM" name="" class="form-control" required>
                        <input type="number" placeholder="YY" name="" class="form-control" required>
                      </div>
                    </div>
                  </div>
                  <div class="col-sm-4">
                    <div class="form-group mb-4">
                      <label title="Three-digits code on the back of your card">CVV
                                                  <i class="fa fa-question-circle"></i>
                                              </label>
                      <input type="text" required class="form-control">
                    </div>
                  </div>
  
  
  
                </div>
                <button type="button" class="subscribe btn btn-primary btn-block rounded-pill shadow-sm"> Confirm  </button>
              </form>
            </div>
            <!-- End -->
  
            <!-- Paypal info -->
            <div id="nav-tab-paypal" class="tab-pane fade">
              <p>Paypal is easiest way to pay online</p>
              <p>
                <button type="button" class="btn btn-primary rounded-pill"><i class="fa fa-paypal mr-2"></i> Log into my Paypal</button>
              </p>
              <p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
              </p>
            </div>
            <!-- End -->
  
            <!-- bank transfer info -->
            <div id="nav-tab-bank" class="tab-pane fade">
              <h6>Bank account details</h6>
              <dl>
                <dt>Bank</dt>
                <dd> THE WORLD BANK</dd>
              </dl>
              <dl>
                <dt>Account number</dt>
                <dd>7775877975</dd>
              </dl>
              <dl>
                <dt>IBAN</dt>
                <dd>CZ7775877975656</dd>
              </dl>
              <p class="text-muted">Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
              </p>
            </div>
            <!-- End -->
          </div>
          <!-- End -->
  
        </div>
      </div>
    </div>
  </div>

 

5. Now friends we need to add below code into src/index.html file:

<head>
...
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">

  <style>
  /*
*
* ==========================================
* FOR DEMO PURPOSES
* ==========================================
*
*/

body {
    background: #f5f5f5!important;
  }
  
  .rounded-lg {
    border-radius: 1rem;
  }
  
  .nav-pills .nav-link {
    color: #555;
  }
  
  .nav-pills .nav-link.active {
    color: #fff;
  }
  </style>
</head>

 

Friends in the end must run ng serve command into your terminal to run the angular 11 project.

Now we are done friends. If you have any kind of query, suggestion and new requirement then feel free to comment below.

Note: Friends, In this post, I just tell the basic setup and things, you can change the code according to your requirements. For better live working experience, please check the video on the top.

I will appreciate that if you will tell your views for this post. Nothing matters if your views will be good or bad because with your views, I will make my next posts more good and helpful.

Jassa

Thanks

therichpost
the authortherichpost
Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.

2 Comments

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.