Spring Angular Search Field Application

Last updated on May 31 2022
Santosh Prakash

Table of Contents

Spring Angular Search Field Application

In this blog, we are going to create a Search Field web application. This application includes data in a tabular form with search fields. In this integration, we are using Spring to handle the backend part and Angular to handle the frontend part.

Working of Application

  • Once we deployed our application on the server, a form generates that contains the data in a tabular form with some search fields.
  • Now, we can search for the data present in the table from these fields. Here, we are using two search fields – name and email-id.
  • To search the data, it is required to provide a complete keyword in any of the search fields.

Tools to be used

  • Use any IDE to develop the Spring and Hibernate project. It may be MyEclipse/Eclipse/Netbeans. Here, we are using Eclipse.
  • MySQL for the database.
  • Use any IDE to develop the Angular project. It may be Visual Studio Code/Sublime. Here, we are using Visual Studio Code.
  • Server: Apache Tomcat/JBoss/Glassfish/Weblogic/Websphere.

Technologies we used

Here, we are using the following technologies:

  • Spring 5
  • Hibernate 5
  • Angular 6
  • MYSQL

Create Database

Let’s create a database searchfieldexample. There is no need to create a table as Hibernate automatically created it. Here, we need to provide the data explicitly in the table so that it can appear on the screen to perform search operations. However, we can also import the data from the file present in the download link.

Spring Module

Let’s see the directory structure of Spring we need to follow:

To develop a search field application, follow the below steps: –

  • Add dependencies to pom.xml file.

pom.xml

  1. <project xmlns=”http://maven.apache.org/POM/4.0.0″ xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance”
  2.   xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd”>
  3.   <modelVersion>4.0.0</modelVersion>
  4.   <groupId>com. tecklearn</groupId>
  5.   <artifactId>SearchFieldExample</artifactId>
  6.   <packaging>war</packaging>
  7.   <version>0.0.1-SNAPSHOT</version>
  8.   <name>SearchFieldExample Maven Webapp</name>
  9.   <url>http://maven.apache.org</url>
  10.   <properties>
  11.         <springframework.version>5.0.6.RELEASE</springframework.version>
  12.         <hibernate.version>5.2.16.Final</hibernate.version>
  13.         <mysql.connector.version>5.1.45</mysql.connector.version>
  14.         <c3po.version>0.9.5.2</c3po.version>
  15.         <maven.compiler.source>1.8</maven.compiler.source>
  16.         <maven.compiler.target>1.8</maven.compiler.target>
  17.     </properties>
  18.   <dependencies>
  19.     <!– Spring –>
  20.     <dependency>
  21.         <groupId>org.springframework</groupId>
  22.         <artifactId>spring-webmvc</artifactId>
  23.         <version>${springframework.version}</version>
  24.     </dependency>
  25.     <dependency>
  26.         <groupId>org.springframework</groupId>
  27.         <artifactId>spring-tx</artifactId>
  28.         <version>${springframework.version}</version>
  29.     </dependency>
  30.     <dependency>
  31.         <groupId>org.springframework</groupId>
  32.         <artifactId>spring-orm</artifactId>
  33.         <version>${springframework.version}</version>
  34.     </dependency>
  35.     <!– Add Jackson for JSON converters –>
  36.     <dependency>
  37.         <groupId>com.fasterxml.jackson.core</groupId>
  38.         <artifactId>jackson-databind</artifactId>
  39.         <version>2.9.5</version>
  40.     </dependency>
  41.     <!– Hibernate –>
  42.     <dependency>
  43.         <groupId>org.hibernate</groupId>
  44.         <artifactId>hibernate-core</artifactId>
  45.         <version>${hibernate.version}</version>
  46.     </dependency>
  47.     <!– MySQL –>
  48.     <dependency>
  49.         <groupId>mysql</groupId>
  50.         <artifactId>mysql-connector-java</artifactId>
  51.         <version>${mysql.connector.version}</version>
  52.     </dependency>
  53.     <!– C3PO –>
  54.     <dependency>
  55.         <groupId>com.mchange</groupId>
  56.         <artifactId>c3p0</artifactId>
  57.         <version>${c3po.version}</version>
  58.     </dependency>
  59.     <!– Servlet+JSP+JSTL –>
  60.     <dependency>
  61.         <groupId>javax.servlet</groupId>
  62.         <artifactId>javax.servlet-api</artifactId>
  63.         <version>3.1.0</version>
  64.     </dependency>
  65.     <dependency>
  66.         <groupId>javax.servlet.jsp</groupId>
  67.         <artifactId>javax.servlet.jsp-api</artifactId>
  68.         <version>2.3.1</version>
  69.     </dependency>
  70.     <dependency>
  71.         <groupId>javax.servlet</groupId>
  72.         <artifactId>jstl</artifactId>
  73.         <version>1.2</version>
  74.     </dependency>
  75.     <!– to compensate for java 9 not including jaxb –>
  76.     <dependency>
  77.         <groupId>javax.xml.bind</groupId>
  78.         <artifactId>jaxb-api</artifactId>
  79.         <version>2.3.0</version>
  80.     </dependency>
  81.     <!–  JUnit dependency –>
  82.     <dependency>
  83.         <groupId>junit</groupId>
  84.         <artifactId>junit</artifactId>
  85.         <version>3.8.1</version>
  86.         <scope>test</scope>
  87.     </dependency>
  88.   </dependencies>
  89.   <build>
  90.     <finalName>SearchFieldExample</finalName>
  91.   </build>
  92. </project>
  • Create the configuration classes
    Instead of XML, we perform annotation-based configuration. So, we create two classes and specify the required configuration in it.

DemoAppConfig.java

  1. package com. tecklearn.searchfieldexample.config;
  2. import java.beans.PropertyVetoException;
  3. import java.util.Properties;
  4. import javax.sql.DataSource;
  5. import org.hibernate.SessionFactory;
  6. import org.springframework.beans.factory.annotation.Autowired;
  7. import org.springframework.context.annotation.Bean;
  8. import org.springframework.context.annotation.ComponentScan;
  9. import org.springframework.context.annotation.Configuration;
  10. import org.springframework.context.annotation.PropertySource;
  11. import org.springframework.core.env.Environment;
  12. import org.springframework.orm.hibernate5.HibernateTransactionManager;
  13. import org.springframework.orm.hibernate5.LocalSessionFactoryBean;
  14. import org.springframework.transaction.annotation.EnableTransactionManagement;
  15. import org.springframework.web.servlet.config.annotation.EnableWebMvc;
  16. import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
  17. import com.mchange.v2.c3p0.ComboPooledDataSource;
  18. @Configuration
  19. @EnableWebMvc
  20. @EnableTransactionManagement
  21. @ComponentScan(“com. tecklearn.searchfieldexample”)
  22. @PropertySource(value = { “classpath:persistence-mysql.properties” })
  23. @PropertySource(value = { “classpath:persistence-mysql.properties” })
  24. @PropertySource(value = { “classpath:application.properties” })
  25. public class DemoAppConfig implements WebMvcConfigurer {
  26.     @Autowired
  27.     private Environment env;
  28.     @Bean
  29.     public DataSource myDataSource() {
  30.         // create connection pool
  31.         ComboPooledDataSource myDataSource = new ComboPooledDataSource();
  32.         // set the jdbc driver
  33.         try {
  34.             myDataSource.setDriverClass(“com.mysql.jdbc.Driver”);
  35.         }
  36.         catch (PropertyVetoException exc) {
  37.             throw new RuntimeException(exc);
  38.         }
  39.         // set database connection props
  40.         myDataSource.setJdbcUrl(env.getProperty(“jdbc.url”));
  41.         myDataSource.setUser(env.getProperty(“jdbc.user”));
  42.         myDataSource.setPassword(env.getProperty(“jdbc.password”));
  43.         // set connection pool props
  44.         myDataSource.setInitialPoolSize(getIntProperty(“connection.pool.initialPoolSize”));
  45.         myDataSource.setMinPoolSize(getIntProperty(“connection.pool.minPoolSize”));
  46.         myDataSource.setMaxPoolSize(getIntProperty(“connection.pool.maxPoolSize”));
  47.         myDataSource.setMaxIdleTime(getIntProperty(“connection.pool.maxIdleTime”));
  48.         return myDataSource;
  49.     }
  50.     private Properties getHibernateProperties() {
  51.         // set hibernate properties
  52.         Properties props = new Properties();
  53.         props.setProperty(“hibernate.dialect”, env.getProperty(“hibernate.dialect”));
  54.         props.setProperty(“hibernate.show_sql”, env.getProperty(“hibernate.show_sql”));
  55.         props.setProperty(“hibernate.format_sql”, env.getProperty(“hibernate.format_sql”));
  56.         props.setProperty(“hibernate.hbm2ddl.auto”, env.getProperty(“hibernate.hbm2ddl”));
  57.         return props;
  58.     }
  59.     // need a helper method
  60.         // read environment property and convert to int
  61.         private int getIntProperty(String propName) {
  62.             String propVal = env.getProperty(propName);
  63.             // now convert to int
  64.             int intPropVal = Integer.parseInt(propVal);
  65.             return intPropVal;
  66.         }
  67.         @Bean
  68.         public LocalSessionFactoryBean sessionFactory(){
  69.             // create session factorys
  70.             LocalSessionFactoryBean sessionFactory = new LocalSessionFactoryBean();
  71.             // set the properties
  72.             sessionFactory.setDataSource(myDataSource());
  73.             sessionFactory.setPackagesToScan(env.getProperty(“hibernate.packagesToScan”));
  74.             sessionFactory.setHibernateProperties(getHibernateProperties());
  75.             return sessionFactory;
  76.         }
  77.         @Bean
  78.         @Autowired
  79.         public HibernateTransactionManager transactionManager(SessionFactory sessionFactory) {
  80.             // setup transaction manager based on session factory
  81.             HibernateTransactionManager txManager = new HibernateTransactionManager();
  82.             txManager.setSessionFactory(sessionFactory);
  83.             return txManager;
  84.         }
  85. }

MySpringMvcDispatcherServletInitializer.java

  1. package com. tecklearn.searchfieldexample.config;
  2. import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatcherServletInitializer;
  3. public class MySpringMvcDispatcherServletInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
  4.     @Override
  5.     protected Class<?>[] getRootConfigClasses() {
  6.         // TODO Auto-generated method stub
  7.         return null;
  8.     }
  9.     @Override
  10.     protected Class<?>[] getServletConfigClasses() {
  11.         return new Class[] { DemoAppConfig.class };
  12.     }
  13.     @Override
  14.     protected String[] getServletMappings() {
  15.         return new String[] { “/” };
  16.     }
  17. }
  • Create the entity class
    Here, we are creating an Entity/POJO (Plain Old Java Object) class.

User.java

  1. package com. tecklearn.searchfieldexample.entity;
  2. import javax.persistence.Column;
  3. import javax.persistence.Entity;
  4. import javax.persistence.GeneratedValue;
  5. import javax.persistence.GenerationType;
  6. import javax.persistence.Id;
  7. import javax.persistence.Table;
  8. @Entity
  9. @Table(name=”user”)
  10. public class User {
  11.     @Id
  12.     @GeneratedValue(strategy=GenerationType.AUTO)
  13.     @Column(name=”userId”)
  14.     private int userId;
  15.     @Column(name=”name”)
  16.     private String name;
  17.     @Column(name=”email_id” )
  18.     public String emailId;
  19.     @Column(name=”qualification”)
  20.     public String qualification;
  21.     public User() {}
  22.     public User(int userId, String name, String emailId, String qualification) {
  23.         super();
  24.         this.userId = userId;
  25.         this.name = name;
  26.         this.emailId = emailId;
  27.         this.qualification = qualification;
  28.     }
  29.     public int getUserId() {
  30.         return userId;
  31.     }
  32.     public void setUserId(int userId) {
  33.         this.userId = userId;
  34.     }
  35.     public String getName() {
  36.         return name;
  37.     }
  38.     public void setName(String name) {
  39.         this.name = name;
  40.     }
  41.     public String getEmailId() {
  42.         return emailId;
  43.     }
  44.     public void setEmailId(String emailId) {
  45.         this.emailId = emailId;
  46.     }
  47.     public String getQualification() {
  48.         return qualification;
  49.     }
  50.     public void setQualification(String qualification) {
  51.         this.qualification = qualification;
  52.     }
  53.     @Override
  54.     public String toString() {
  55.         return “User [userId=” + userId + “, name=” + name + “, emailId=” + emailId + “, qualification=” + qualification
  56.                 + “]”;
  57.     }
  58. }
  • Create the DAO interface
    Here, we are creating the DAO interface to perform database related operations.

UserDAO.java

  1. package com. tecklearn.searchfieldexample.DAO.interfaces;
  2. import java.util.List;
  3. import com. tecklearn.searchfieldexample.entity.User;
  4. public interface UserDAO {
  5.     public int SaveUser(User user);
  6.     public List<User> getFilteredData(User user);
  7. }
  • Create the DAO interface implementation class

UserDAOImpl.java

  1. package com. tecklearn.searchfieldexample.DAO.implementation;
  2. import java.util.ArrayList;
  3. import java.util.List;
  4. import org.hibernate.Session;
  5. import org.hibernate.SessionFactory;
  6. import org.hibernate.query.Query;
  7. import org.springframework.beans.factory.annotation.Autowired;
  8. import org.springframework.stereotype.Repository;
  9. import com. tecklearn.searchfieldexample.DAO.interfaces.UserDAO;
  10. import com. tecklearn.searchfieldexample.entity.User;
  11. @Repository(“userDAO”)
  12. public class UserDAOImpl implements UserDAO {
  13.     @Autowired
  14.     SessionFactory sessionFactory;
  15.     public int SaveUser(User user) {
  16.         Session session = null;
  17.         try {
  18.             session = sessionFactory.getCurrentSession();
  19.             int userId = (Integer) session.save(user);
  20.             return userId;
  21.         }
  22.         catch(Exception exception)
  23.         {
  24.             System.out.println(“Excption while saving data into DB ” + exception);
  25.             return 0;
  26.         }
  27.         finally
  28.         {
  29.             session.flush();
  30.         }
  31.     }
  32.     public List<User> getFilteredData(User user) {
  33.         Session session = null;
  34.         try
  35.         {
  36.             session = sessionFactory.getCurrentSession();
  37.             ArrayList<Object> list_field = new ArrayList<Object>();
  38.             ArrayList<Object> list_value = new ArrayList<Object>();
  39.             if(user.getName()==null || user.getName()==””){}else{list_field.add(“name”);list_value.add(user.getName());}
  40.             if(user.getEmailId()==null || user.getEmailId()==””){}else{list_field.add(“emailId”);list_value.add(user.getEmailId());}
  41.             switch (list_field.size()) {
  42.             case 0:
  43.                     Query<User> query0 = session.createQuery(“from User”);
  44.                     return query0.list();
  45.             case 1:
  46.                 Query query1 = session.createQuery(“from User where ” + list_field.get(0) +” = :value0″);
  47.                 query1.setParameter(“value0”, list_value.get(0));
  48.                 return query1.list();
  49.             case 2:
  50.                 Query query2 = session.createQuery(“from User where ” + list_field.get(0) +” =:value0 and ” + list_field.get(1) + ” =:value1″);
  51.                 query2.setParameter(“value0”, list_value.get(0));
  52.                 query2.setParameter(“value1”, list_value.get(1));
  53.                 return query2.list();
  54.             }
  55.             return null;
  56.         }
  57.         catch(Exception exception)
  58.         {
  59.             System.out.println(“Error while getting Filtered Data :: ” + exception.getMessage());
  60.             return null;
  61.         }
  62.         finally
  63.         {
  64.             session.flush();
  65.         }
  66.     }
  67. }
  • Create the service layer interface
    Here, we are creating a service layer interface that acts as a bridge between DAO and Entity classes.

UserService.java

  1. package com. tecklearn.searchfieldexample.service.interfaces;
  2. import java.util.List;
  3. import com. tecklearn.searchfieldexample.entity.User;
  4. public interface UserService {
  5.     public int SaveUser(User user);
  6.     public List<User> getFilteredData(User user);
  7. }
  • Create the service layer implementation class

UserServiceImpl.java

  1. package com. tecklearn.searchfieldexample.service.implementation;
  2. import java.util.List;
  3. import javax.transaction.Transactional;
  4. import org.springframework.beans.factory.annotation.Autowired;
  5. import org.springframework.stereotype.Service;
  6. import com. tecklearn.searchfieldexample.DAO.interfaces.UserDAO;
  7. import com. tecklearn.searchfieldexample.entity.User;
  8. import com. tecklearn.searchfieldexample.service.interfaces.UserService;
  9. @Service(“userService”)
  10. public class UserServiceImpl implements UserService {
  11.     @Autowired
  12.     UserDAO userDAO;
  13.     @Transactional
  14.     public int SaveUser(User user) {
  15.         return userDAO.SaveUser(user) ;
  16.     }
  17.     @Transactional
  18.     public List<User> getFilteredData(User user) {
  19.         return userDAO.getFilteredData(user);
  20.     }
  21. }
  • Create the controller class

UserController.java

  1. package com. tecklearn.searchfieldexample.restcontroller;
  2. import java.util.List;
  3. import org.springframework.beans.factory.annotation.Autowired;
  4. import org.springframework.web.bind.annotation.CrossOrigin;
  5. import org.springframework.web.bind.annotation.PostMapping;
  6. import org.springframework.web.bind.annotation.RequestBody;
  7. import org.springframework.web.bind.annotation.RequestMapping;
  8. import org.springframework.web.bind.annotation.RestController;
  9. import com. tecklearn.searchfieldexample.entity.User;
  10. import com. tecklearn.searchfieldexample.service.interfaces.UserService;
  11. @RestController
  12. @RequestMapping(“/api”)
  13. @CrossOrigin(origins = “http://localhost:4200”, allowedHeaders = “*”, exposedHeaders = “Authorization”)
  14. public class UserController {
  15.     @Autowired
  16.     private UserService userService;
  17.     @PostMapping(“/saveUser”)
  18.     public int saveAdminDetail(@RequestBody User user) {
  19.         return userService.SaveUser(user);
  20.     }
  21.     @PostMapping(“/filterData”)
  22.     public List<User> getFilteredData(@RequestBody User user) {
  23.         return userService.getFilteredData(user);
  24.     }
  25. }
  • Creating the properties file
    Here, we are creating the properties file inside the src/main/resources in the project.

persistence-mysql.properties

  1. #
  2. # JDBC connection properties
  3. #
  4. jdbc.driver=com.mysql.jdbc.Driver
  5. jdbc.url=jdbc:mysql://localhost:3306/searchfieldexample?useSSL=false
  6. jdbc.user=root
  7. jdbc.password=
  8. #
  9. # Connection pool properties
  10. #
  11. connection.pool.initialPoolSize=5
  12. connection.pool.minPoolSize=5
  13. connection.pool.maxPoolSize=20
  14. connection.pool.maxIdleTime=3000
  15. #
  16. # Hibernate properties
  17. #
  18. <!– hibernate.dialect=org.hibernate.dialect.MySQLDialect –>
  19. hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
  20. hibernate.show_sql=true
  21. hibernate.format_sql=true
  22. hibernate.hbm2ddl=update
  23. hibernate.packagesToScan=com. tecklearn.searchfieldexample.entity

Angular Module

Let’s see the directory structure of Angular we need to follow:

image002 11
directory
  • Create an Angular project

Let’s create an Angular project by using the following command:

ng new SearchFieldExample

image003 13
Angular project
image004 10
Angular project

Here, SearchFieldExample is the name of the project.

Install Bootstrap CSS framework

Use the following command to install bootstrap in the project.

npm install bootstrap@3.3.7 –save

Now, include the following code in the style.css file.

  1. @import “~bootstrap/dist/css/bootstrap.css”;
  • Generate Component
    Open the project in visual studio and then use the following command to generate Angular component:
    ng g c ShowData
image005 11
Component

Let’s also create a service class by using the following command: –

image006 9
class

ng g s services/User

  • Edit the app.module.ts file
    • Import HttpModule – Here, we are importing HttpModule for server requests and specifying it in imports array.
    • Register Service class – Here, we are mentioning the service class in providers array.
    • Import ReactiveFormsModule – Here, we are importing ReactiveFormsModule for reactive forms and specifying it in imports array.
  1. import { BrowserModule } from ‘@angular/platform-browser’;
  2. import { NgModule } from ‘@angular/core’;
  3. // import ReactiveFormsModule for reactive form
  4. import { ReactiveFormsModule } from ‘@angular/forms’;
  5. // import Http module
  6. import { HttpModule } from ‘@angular/http’;
  7. import { AppComponent } from ‘./app.component’;
  8. import { ShowDataComponent } from ‘./show-data/show-data.component’;
  9. import { UserService } from ‘./services/user.service’;
  10. @NgModule({
  11.   declarations: [
  12.     AppComponent,
  13.     ShowDataComponent
  14.   ],
  15.   imports: [
  16.     BrowserModule,
  17.     ReactiveFormsModule,
  18.     HttpModule
  19.   ],
  20.   providers: [UserService],
  21.   bootstrap: [AppComponent]
  22. })
  23. export class AppModule { }
  • Edit the app.component.html file
  1. <app-show-data></app-show-data>
  • Create the User.ts class

Let’s create a class by using the following command: –

ng g class classes/User

image007 8
User

Now, specify the required fields within the User class.

  1. export class User {
  2.     name : string;
  3.     emailId : string;
  4.     qualification : string;
  5. }

The purpose of this class is to map the specified fields with the fields of the Spring entity class.

  • Edit the user.service.ts file
  1. import { Injectable } from ‘@angular/core’;
  2. import { User } from ‘../classes/user’;
  3. import { Http } from ‘@angular/http’;
  4. @Injectable({
  5.   providedIn: ‘root’
  6. })
  7. export class UserService {
  8.   private baseUrl = “http://localhost:8080/SearchFieldExample/api/”;
  9.   constructor(private http : Http) { }
  10.   getData(user : User)
  11.   {
  12.     let url = this.baseUrl + “filterData”;
  13.     return  this.http.post(url , user);
  14.   }
  15. }
  • Edit the show-data.component.ts file
  1. import { Component, OnInit } from ‘@angular/core’;
  2. import { User } from ‘../classes/user’;
  3. import { UserService } from ‘../services/user.service’;
  4. import { FormGroup, FormControl } from ‘@angular/forms’;
  5. @Component({
  6.   selector: ‘app-show-data’,
  7.   templateUrl: ‘./show-data.component.html’,
  8.   styleUrls: [‘./show-data.component.css’]
  9. })
  10. export class ShowDataComponent implements OnInit {
  11.   private user = new User();
  12.   private data;
  13.   constructor(private userService : UserService) { }
  14.   ngOnInit() {
  15.     this.getData(this.user);
  16.   }
  17.   form = new FormGroup({
  18.     name : new FormControl(),
  19.     email : new FormControl()
  20.   });
  21.   getData(user)
  22.   {
  23.       this.userService.getData(user).subscribe(
  24.         response => {
  25.           this.data = response.json();
  26.         },
  27.         error => {
  28.           console.log(“error while getting user Details”);
  29.         }
  30.       );
  31.   }
  32.   searchForm(searchInfo)
  33.   {
  34.         this.user.name = this.Name.value;
  35.         this.user.emailId = this.Email.value;
  36.         this.getData(this.user);
  37.   }
  38.   get Name()
  39.   {
  40.     return this.form.get(‘name’);
  41.   }
  42.   get Email()
  43.   {
  44.     return this.form.get(’email’);
  45.   }
  46. }
  • Edit the show-data.component.html file
  1. <br><br>
  2. <div class=”row”>
  3.     <div class=”col-md-offset-4 col-md-4″>
  4.         <form [formGroup]=”form” #searchInfo (ngSubmit)=”searchForm(searchInfo)”>
  5.             <table>
  6.                 <tr>
  7.                     <td> <input type=”text” formControlName=”name” placeholder=”Enter name” class=”form-control”> </td>
  8.                     <td> <input type=”text” formControlName=”email” placeholder=”Enter EmailId” class=”form-control”> </td>
  9.                     <td><button class=”btn btn-primary hidden-xs”>Search</button></td>
  10.                 </tr>
  11.             </table>
  12.         </form>
  13.     </div>
  14. </div>
  15. <br><br>
  16. <div class=”row”>
  17.     <div class=”col-md-offset-4 col-md-4″>
  18.         <table class=”table table-bordered table-striped table-responsive”>
  19.             <tr>
  20.                 <th>Name</th>
  21.                 <th>Email</th>
  22.                 <th>Qualification</th>
  23.             </tr>
  24.             <ng-container *ngFor=”let item of data”>
  25.                 <tr>
  26.                     <td>{{item.name}}</td>
  27.                     <td>{{item.emailId}}</td>
  28.                     <td>{{item.qualification}}</td>
  29.                 </tr>
  30.             </ng-container>
  31.         </table>
  32.     </div>
  33. </div>

Once completed, enter the URL http://localhost:4200/ at the web browser. The following web page occurs:

image008 10
page

Now, we can search the data by providing a specific keyword in the search field.

Search by name:

image009 5
Search by name

Search by email-id:

image010 6
email-id

So, this brings us to the end of blog. This Tecklearn ‘Spring Angular Search Field Application’ blog helps you with commonly asked questions if you are looking out for a job in Angular JS and Front-End Development. If you wish to learn Angular JS and build a career in Front-End Development domain, then check out our interactive, Angular JS Training, that comes with 24*7 support to guide you throughout your learning period. Please find the link for course details:

https://www.tecklearn.com/course/angular-js-training/

Angular JS Training

About the Course

Angular JS certification training is designed for developers who are responsible for building applications using AngularJS. Through a combination of presentations and hands-on practices, participants will explore Angular comprehensively and learn to build components, directives, template-driven forms, routing, etc. for complex data-centric (enterprise) applications. This Angular online training will update your knowledge and skills with the current Angular version to lift your career.

Why Should you take Angular JS Training?

  • The average salary for “Angular Developer” ranges from approximately $92,814 per year for a Developer to $113,069 per year for a Full Stack Developer (Indeed.com).
  • YouTube, Google, Cisco, Nike, Samsung, Microsoft, Forbes, BMW and many Fortune 500 companies are using Angular as their front-end development framework to deliver an engaging user experience.
  • Angular’s powerful cross-platform feature allows developers to build progressive web applications and native mobile applications.

What you will Learn in this Course?

Introduction to Angular

  • Introduction to Angular
  • Comparison between front-end tools
  • Angular Architecture
  • Building blocks of Angular
  • Angular Installation
  • Angular CLI
  • Angular CLI commands
  • Angular Modules

Angular Components and Data Binding

  • Working of Angular Applications
  • Angular App Bootstrapping
  • Angular Components
  • Creating A Component Through Angular CLI
  • Ways to specify selectors
  • Template and styles
  • Installing bootstrap to design application
  • Data Binding
  • Types of Data Binding
  • Component Interaction using @Input and @Output decorator
  • Angular Animations

TypeScript

  • What is TypeScript
  • Need of TypeScript
  • How to install TypeScript
  • Nodemon for monitoring changes
  • Interfaces in Class, String Templates, Maps,
  • Sets and Object Restructuring

Directives and Pipes in Angular

  • Angular Directives
  • @Component Directive
  • Structural Directives
  • Attribute Directives
  • Custom Directives
  • Pipes
  • Built-in Pipes
  • Chaining pipes
  • Custom pipes
  • Pipe Transform Interface & Transform Function
  • Pure and Impure pipes

Angular Services and Dependency Injection

  • Angular service
  • Need for a service
  • Dependency Injection
  • Creating a service
  • Hierarchical Injector
  • Injecting A Service into Another Service
  • Observables
  • RxJS Library
  • Angular’s Interaction with Backend
  • Parts of an Http Request
  • HttpClient

Forms in Angular

  • Forms in Angular
  • What are their functions
  • Advantages of Forms
  • Various Types of Forms
  • What is Angular Validation and Model driven approach

Angular Routing

  • Angular Routing
  • Angular Routing benefits and features
  • Building a single page application and updating it dynamically with Angular Routing
  • What is Parameter Routing
  • Router Lifecycle Hooks and Child Routes

Authentication and Security in Angular

  • What is Authentication?
  • Authentication and authorization
  • Types of Authentication
  • Where to store tokens?
  • JSON Web Tokens (JWT)
  • Authentication in Angular application
  • Security threats in web application

Testing Angular applications

  • Testing of Angular applications
  • Deployment of Angular Test Bed for testing on Angular framework
  • Setup of various tools for testing
  • Testing services in Angular Framework
  • E2E and Document Object Model testing

Got a question for us? Please mention it in the comments section and we will get back to you.

0 responses on "Spring Angular Search Field Application"

Leave a Message

Your email address will not be published. Required fields are marked *