Categories: Uncategorized

Angular Spring boot API Bootstrap Table load

This Angular and Spring boot tutorial will teach you how to view the records using Restful API.

First you have to run the Back-end Spring Boot Application

Study RestFul Api How to Works  for beginners here.

if you not watch my angular tutorial  please watch them then only you will clear of angular link here.

After That Create a new component in Angular

ng g c employeetable

in the employeetable.component.html  paste the following code.

employeetable.component.html

<table class="table">
    <thead>
      <tr>
        <th scope="col">Employee Name</th>
        <th scope="col">Address</th>
        <th scope="col">Salary USD</th>
      </tr>
    </thead>
    <tbody>
      <h1 *ngIf="!isResultLoaded">Loading.................</h1>
      <tr *ngFor="let EmployeeItem of EmployeeArray">
        <td>{{EmployeeItem.employeeName  | uppercase}}</td>
        <td>{{EmployeeItem.employeeAddress }}</td>
        <td>{{EmployeeItem.employeeSalary | currency:'USD'}}</td> 
      </tr>   
    </tbody>
  </table>

employeetable.component.ts

import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';

@Component({
  selector: 'app-employeetable',
  templateUrl: './employeetable.component.html',
  styleUrls: ['./employeetable.component.scss']
})
export class EmployeetableComponent implements OnInit {


  EmployeeArray : any[] = [];

  isResultLoaded = false;

  
  constructor(private http: HttpClient) 
  {
    this.getAllEmployee();
  }
 
  ngOnInit(): void {
    this.getAllEmployee();
  }
  
  getAllEmployee()
  { 
  this.http.get("http://localhost:8088/api/v1/employee/get-all-employees").subscribe((resultData: any)=>
    {
        this.isResultLoaded = true;
        console.log(resultData);
        this.EmployeeArray = resultData;
    });
  }
}

i have attached the video link below. which will do this tutorials step by step

 

admin

Recent Posts

Laravel 11 CRUD Mastering RESTful API MVC with Repository Pattern

In this tutorial will teach Laravel 11 Api MVC with Repository Pattern Crud Application step…

3 weeks ago

Laravel 11 CRUD Application

In this tutorial will teach Laravel 11 CRUD Application step by step. Laravel  11 CRUD…

1 month ago

How to make Times Table in React

in this tutorials we will be talk about how to make a times table in…

2 months ago

Laravel Tutorial: How to Add Numbers Easily Laravel 10

In this tutorials will teach How to add two numbers in Laravel 10. (more…)

2 months ago

Build Full-Stack Node.js MongoDB CRUD App with JWT Authentication

In this tutorial, we will teach the process of building a full-stack application using Node.js,…

3 months ago

Hospital Management System using OOP Java and MySQL

In this tutorial, we will explin you through the process of building a Hospital Management…

3 months ago