├── angular-6-springboot-client
├── src
│ ├── app
│ │ ├── app.component.css
│ │ ├── employee-list
│ │ │ ├── employee-list.component.css
│ │ │ ├── employee-list.component.spec.ts
│ │ │ ├── employee-list.component.html
│ │ │ └── employee-list.component.ts
│ │ ├── create-employee
│ │ │ ├── create-employee.component.css
│ │ │ ├── create-employee.component.spec.ts
│ │ │ ├── create-employee.component.ts
│ │ │ └── create-employee.component.html
│ │ ├── employee-details
│ │ │ ├── employee-details.component.css
│ │ │ ├── employee-details.component.ts
│ │ │ ├── employee-details.component.html
│ │ │ └── employee-details.component.spec.ts
│ │ ├── employee.ts
│ │ ├── employee.spec.ts
│ │ ├── app.component.ts
│ │ ├── employee.service.spec.ts
│ │ ├── app.component.html
│ │ ├── app-routing.module.ts
│ │ ├── app.module.ts
│ │ ├── employee.service.ts
│ │ └── app.component.spec.ts
│ ├── environments
│ │ ├── environment.prod.ts
│ │ └── environment.ts
│ ├── styles.css
│ ├── favicon.ico
│ ├── tsconfig.app.json
│ ├── tsconfig.spec.json
│ ├── index.html
│ ├── tslint.json
│ ├── main.ts
│ ├── browserslist
│ ├── test.ts
│ ├── karma.conf.js
│ └── polyfills.ts
├── .angulardoc.json
├── proxy.conf.json
├── e2e
│ ├── src
│ │ ├── app.po.ts
│ │ └── app.e2e-spec.ts
│ ├── tsconfig.e2e.json
│ └── protractor.conf.js
├── .editorconfig
├── tsconfig.json
├── .gitignore
├── README.md
├── package.json
├── tslint.json
└── angular.json
├── springboot2-jpa-crud-example
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.properties
│ │ └── maven-wrapper.jar
├── .gitignore
├── src
│ ├── main
│ │ ├── java
│ │ │ └── net
│ │ │ │ └── guides
│ │ │ │ └── springboot2
│ │ │ │ └── springboot2jpacrudexample
│ │ │ │ ├── Application.java
│ │ │ │ ├── repository
│ │ │ │ └── EmployeeRepository.java
│ │ │ │ ├── exception
│ │ │ │ ├── ResourceNotFoundException.java
│ │ │ │ ├── ErrorDetails.java
│ │ │ │ └── GlobalExceptionHandler.java
│ │ │ │ ├── model
│ │ │ │ └── Employee.java
│ │ │ │ └── controller
│ │ │ │ └── EmployeeController.java
│ │ └── resources
│ │ │ └── application.properties
│ └── test
│ │ └── java
│ │ └── net
│ │ └── guides
│ │ └── springboot2
│ │ └── springboot2jpacrudexample
│ │ ├── ApplicationTests.java
│ │ └── EmployeeControllerIntegrationTest.java
├── pom.xml
├── mvnw.cmd
└── mvnw
└── README.md
/angular-6-springboot-client/src/app/app.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-list/employee-list.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/create-employee/create-employee.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-details/employee-details.component.css:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/.angulardoc.json:
--------------------------------------------------------------------------------
1 | {
2 | "repoId": "2af7219a-c3eb-48de-9543-b2b58784bdef",
3 | "lastSync": 0
4 | }
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/proxy.conf.json:
--------------------------------------------------------------------------------
1 | {
2 | "/api/v1/employees": {
3 | "target": "http://localhost:8080",
4 | "secure": false
5 | }
6 | }
7 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/angular6-springboot-crud-tutorial/HEAD/angular-6-springboot-client/src/favicon.ico
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.4/apache-maven-3.5.4-bin.zip
2 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee.ts:
--------------------------------------------------------------------------------
1 | export class Employee {
2 | id: number;
3 | firstName: string;
4 | lastName: string;
5 | emailId: string;
6 | active: boolean;
7 | }
8 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/RameshMF/angular6-springboot-crud-tutorial/HEAD/springboot2-jpa-crud-example/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # angular6-springboot-crud-tutorial
2 | Angular 6 + Spring Boot 2 + Spring Data JPA + MySQL + CRUD Tutorial
3 |
4 | http://www.javaguides.net/2019/02/spring-boot-angular-6-crud-example.html
5 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee.spec.ts:
--------------------------------------------------------------------------------
1 | import { Employee } from './employee';
2 |
3 | describe('Employee', () => {
4 | it('should create an instance', () => {
5 | expect(new Employee()).toBeTruthy();
6 | });
7 | });
8 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "types": []
6 | },
7 | "exclude": [
8 | "test.ts",
9 | "**/*.spec.ts"
10 | ]
11 | }
12 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/e2e/src/app.po.ts:
--------------------------------------------------------------------------------
1 | import { browser, by, element } from 'protractor';
2 |
3 | export class AppPage {
4 | navigateTo() {
5 | return browser.get('/');
6 | }
7 |
8 | getTitleText() {
9 | return element(by.css('app-root h1')).getText();
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/e2e/tsconfig.e2e.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/app",
5 | "module": "commonjs",
6 | "target": "es5",
7 | "types": [
8 | "jasmine",
9 | "jasminewd2",
10 | "node"
11 | ]
12 | }
13 | }
--------------------------------------------------------------------------------
/angular-6-springboot-client/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.md]
12 | max_line_length = off
13 | trim_trailing_whitespace = false
14 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.css']
7 | })
8 | export class AppComponent {
9 | title = 'Angular 6 + Spring Boot 2 + Spring Data JPA + MySQL + CRUD Tutorial';
10 | }
11 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tsconfig.json",
3 | "compilerOptions": {
4 | "outDir": "../out-tsc/spec",
5 | "types": [
6 | "jasmine",
7 | "node"
8 | ]
9 | },
10 | "files": [
11 | "test.ts",
12 | "polyfills.ts"
13 | ],
14 | "include": [
15 | "**/*.spec.ts",
16 | "**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Angular6SpringbootClient
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/.gitignore:
--------------------------------------------------------------------------------
1 | /target/
2 | !.mvn/wrapper/maven-wrapper.jar
3 |
4 | ### STS ###
5 | .apt_generated
6 | .classpath
7 | .factorypath
8 | .project
9 | .settings
10 | .springBeans
11 | .sts4-cache
12 |
13 | ### IntelliJ IDEA ###
14 | .idea
15 | *.iws
16 | *.iml
17 | *.ipr
18 |
19 | ### NetBeans ###
20 | /nbproject/private/
21 | /build/
22 | /nbbuild/
23 | /dist/
24 | /nbdist/
25 | /.nb-gradle/
--------------------------------------------------------------------------------
/angular-6-springboot-client/e2e/src/app.e2e-spec.ts:
--------------------------------------------------------------------------------
1 | import { AppPage } from './app.po';
2 |
3 | describe('workspace-project App', () => {
4 | let page: AppPage;
5 |
6 | beforeEach(() => {
7 | page = new AppPage();
8 | });
9 |
10 | it('should display welcome message', () => {
11 | page.navigateTo();
12 | expect(page.getTitleText()).toEqual('Welcome to angular6-springboot-client!');
13 | });
14 | });
15 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/tslint.json:
--------------------------------------------------------------------------------
1 | {
2 | "extends": "../tslint.json",
3 | "rules": {
4 | "directive-selector": [
5 | true,
6 | "attribute",
7 | "app",
8 | "camelCase"
9 | ],
10 | "component-selector": [
11 | true,
12 | "element",
13 | "app",
14 | "kebab-case"
15 | ]
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee.service.spec.ts:
--------------------------------------------------------------------------------
1 | import { TestBed } from '@angular/core/testing';
2 |
3 | import { EmployeeService } from './employee.service';
4 |
5 | describe('EmployeeService', () => {
6 | beforeEach(() => TestBed.configureTestingModule({}));
7 |
8 | it('should be created', () => {
9 | const service: EmployeeService = TestBed.get(EmployeeService);
10 | expect(service).toBeTruthy();
11 | });
12 | });
13 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/browserslist:
--------------------------------------------------------------------------------
1 | # This file is currently used by autoprefixer to adjust CSS to support the below specified browsers
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 | #
5 | # For IE 9-11 support, please remove 'not' from the last line of the file and adjust as needed
6 |
7 | > 0.5%
8 | last 2 versions
9 | Firefox ESR
10 | not dead
11 | not IE 9-11
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/src/main/java/net/guides/springboot2/springboot2jpacrudexample/Application.java:
--------------------------------------------------------------------------------
1 | package net.guides.springboot2.springboot2jpacrudexample;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 |
6 | @SpringBootApplication
7 | public class Application {
8 | public static void main(String[] args) {
9 | SpringApplication.run(Application.class, args);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/src/main/java/net/guides/springboot2/springboot2jpacrudexample/repository/EmployeeRepository.java:
--------------------------------------------------------------------------------
1 | package net.guides.springboot2.springboot2jpacrudexample.repository;
2 |
3 | import org.springframework.data.jpa.repository.JpaRepository;
4 | import org.springframework.stereotype.Repository;
5 |
6 | import net.guides.springboot2.springboot2jpacrudexample.model.Employee;
7 |
8 | @Repository
9 | public interface EmployeeRepository extends JpaRepository{
10 |
11 | }
12 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/src/test/java/net/guides/springboot2/springboot2jpacrudexample/ApplicationTests.java:
--------------------------------------------------------------------------------
1 | package net.guides.springboot2.springboot2jpacrudexample;
2 |
3 | import org.junit.Test;
4 | import org.junit.runner.RunWith;
5 | import org.springframework.boot.test.context.SpringBootTest;
6 | import org.springframework.test.context.junit4.SpringRunner;
7 |
8 | @RunWith(SpringRunner.class)
9 | @SpringBootTest
10 | public class ApplicationTests {
11 |
12 | @Test
13 | public void contextLoads() {
14 | }
15 |
16 | }
17 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compileOnSave": false,
3 | "compilerOptions": {
4 | "baseUrl": "./",
5 | "outDir": "./dist/out-tsc",
6 | "sourceMap": true,
7 | "declaration": false,
8 | "module": "es2015",
9 | "moduleResolution": "node",
10 | "emitDecoratorMetadata": true,
11 | "experimentalDecorators": true,
12 | "importHelpers": true,
13 | "target": "es5",
14 | "typeRoots": [
15 | "node_modules/@types"
16 | ],
17 | "lib": [
18 | "es2018",
19 | "dom"
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/src/main/java/net/guides/springboot2/springboot2jpacrudexample/exception/ResourceNotFoundException.java:
--------------------------------------------------------------------------------
1 | package net.guides.springboot2.springboot2jpacrudexample.exception;
2 |
3 | import org.springframework.http.HttpStatus;
4 | import org.springframework.web.bind.annotation.ResponseStatus;
5 |
6 | @ResponseStatus(value = HttpStatus.NOT_FOUND)
7 | public class ResourceNotFoundException extends Exception{
8 |
9 | private static final long serialVersionUID = 1L;
10 |
11 | public ResourceNotFoundException(String message){
12 | super(message);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/app.component.html:
--------------------------------------------------------------------------------
1 |
2 |
{{title}}
3 |
4 |
5 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/dist/zone-testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: any;
11 |
12 | // First, initialize the Angular testing environment.
13 | getTestBed().initTestEnvironment(
14 | BrowserDynamicTestingModule,
15 | platformBrowserDynamicTesting()
16 | );
17 | // Then we find all the tests.
18 | const context = require.context('./', true, /\.spec\.ts$/);
19 | // And load the modules.
20 | context.keys().map(context);
21 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/src/main/resources/application.properties:
--------------------------------------------------------------------------------
1 | ## Spring DATASOURCE (DataSourceAutoConfiguration & DataSourceProperties)
2 | spring.datasource.url = jdbc:mysql://localhost:3306/users_database?useSSL=false
3 | spring.datasource.username = root
4 | spring.datasource.password = root
5 |
6 |
7 | ## Hibernate Properties
8 | # The SQL dialect makes Hibernate generate better SQL for the chosen database
9 | spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.MySQL5InnoDBDialect
10 |
11 | # Hibernate ddl auto (create, create-drop, validate, update)
12 | spring.jpa.hibernate.ddl-auto = update
13 |
14 | info.app.name=Spring Boot 2 Tutorial
15 | info.app.description=This is a SpringBoot Demo app
16 | info.app.version=1.0.0
17 |
18 |
--------------------------------------------------------------------------------
/springboot2-jpa-crud-example/src/main/java/net/guides/springboot2/springboot2jpacrudexample/exception/ErrorDetails.java:
--------------------------------------------------------------------------------
1 | package net.guides.springboot2.springboot2jpacrudexample.exception;
2 |
3 | import java.util.Date;
4 |
5 | public class ErrorDetails {
6 | private Date timestamp;
7 | private String message;
8 | private String details;
9 |
10 | public ErrorDetails(Date timestamp, String message, String details) {
11 | super();
12 | this.timestamp = timestamp;
13 | this.message = message;
14 | this.details = details;
15 | }
16 |
17 | public Date getTimestamp() {
18 | return timestamp;
19 | }
20 |
21 | public String getMessage() {
22 | return message;
23 | }
24 |
25 | public String getDetails() {
26 | return details;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-details/employee-details.component.ts:
--------------------------------------------------------------------------------
1 | import { Employee } from './../employee';
2 | import { Component, OnInit, Input } from '@angular/core';
3 | import { EmployeeService } from '../employee.service';
4 | import { EmployeeListComponent } from '../employee-list/employee-list.component';
5 |
6 | @Component({
7 | selector: 'app-employee-details',
8 | templateUrl: './employee-details.component.html',
9 | styleUrls: ['./employee-details.component.css']
10 | })
11 | export class EmployeeDetailsComponent implements OnInit {
12 |
13 | @Input() employee: Employee;
14 |
15 | constructor(private employeeService: EmployeeService, private listComponent: EmployeeListComponent) { }
16 |
17 | ngOnInit() {
18 | }
19 |
20 | }
21 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/dist/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-details/employee-details.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 | {{employee.firstName}}
4 |
5 |
6 | {{employee.lastName}}
7 |
8 |
9 | {{employee.emailId}}
10 |
11 |
12 | {{employee.active}}
13 |
14 |
15 |
Inactive
16 |
17 |
Active
18 |
19 |
Delete
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { EmployeeDetailsComponent } from './employee-details/employee-details.component';
2 | import { CreateEmployeeComponent } from './create-employee/create-employee.component';
3 | import { NgModule } from '@angular/core';
4 | import { Routes, RouterModule } from '@angular/router';
5 | import { EmployeeListComponent } from './employee-list/employee-list.component';
6 |
7 | const routes: Routes = [
8 | { path: '', redirectTo: 'employee', pathMatch: 'full' },
9 | { path: 'employees', component: EmployeeListComponent },
10 | { path: 'add', component: CreateEmployeeComponent },
11 | ];
12 |
13 | @NgModule({
14 | imports: [RouterModule.forRoot(routes)],
15 | exports: [RouterModule]
16 | })
17 | export class AppRoutingModule { }
18 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 |
8 | # dependencies
9 | /node_modules
10 |
11 | # profiling files
12 | chrome-profiler-events.json
13 | speed-measure-plugin.json
14 |
15 | # IDEs and editors
16 | /.idea
17 | .project
18 | .classpath
19 | .c9/
20 | *.launch
21 | .settings/
22 | *.sublime-workspace
23 |
24 | # IDE - VSCode
25 | .vscode/*
26 | !.vscode/settings.json
27 | !.vscode/tasks.json
28 | !.vscode/launch.json
29 | !.vscode/extensions.json
30 | .history/*
31 |
32 | # misc
33 | /.sass-cache
34 | /connect.lock
35 | /coverage
36 | /libpeerconnection.log
37 | npm-debug.log
38 | yarn-error.log
39 | testem.log
40 | /typings
41 |
42 | # System Files
43 | .DS_Store
44 | Thumbs.db
45 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-list/employee-list.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { EmployeeListComponent } from './employee-list.component';
4 |
5 | describe('EmployeeListComponent', () => {
6 | let component: EmployeeListComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ EmployeeListComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(EmployeeListComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/create-employee/create-employee.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { CreateEmployeeComponent } from './create-employee.component';
4 |
5 | describe('CreateEmployeeComponent', () => {
6 | let component: CreateEmployeeComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ CreateEmployeeComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(CreateEmployeeComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-list/employee-list.component.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
Employees
4 |
5 |
6 |
7 |
8 |
9 | | Firstname |
10 | Lastname |
11 | Email |
12 | Actions |
13 |
14 |
15 |
16 |
17 | | {{employee.firstName}} |
18 | {{employee.lastName}} |
19 | {{employee.emailId}} |
20 |
21 | |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee-details/employee-details.component.spec.ts:
--------------------------------------------------------------------------------
1 | import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2 |
3 | import { EmployeeDetailsComponent } from './employee-details.component';
4 |
5 | describe('EmployeeDetailsComponent', () => {
6 | let component: EmployeeDetailsComponent;
7 | let fixture: ComponentFixture;
8 |
9 | beforeEach(async(() => {
10 | TestBed.configureTestingModule({
11 | declarations: [ EmployeeDetailsComponent ]
12 | })
13 | .compileComponents();
14 | }));
15 |
16 | beforeEach(() => {
17 | fixture = TestBed.createComponent(EmployeeDetailsComponent);
18 | component = fixture.componentInstance;
19 | fixture.detectChanges();
20 | });
21 |
22 | it('should create', () => {
23 | expect(component).toBeTruthy();
24 | });
25 | });
26 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/e2e/protractor.conf.js:
--------------------------------------------------------------------------------
1 | // Protractor configuration file, see link for more information
2 | // https://github.com/angular/protractor/blob/master/lib/config.ts
3 |
4 | const { SpecReporter } = require('jasmine-spec-reporter');
5 |
6 | exports.config = {
7 | allScriptsTimeout: 11000,
8 | specs: [
9 | './src/**/*.e2e-spec.ts'
10 | ],
11 | capabilities: {
12 | 'browserName': 'chrome'
13 | },
14 | directConnect: true,
15 | baseUrl: 'http://localhost:4200/',
16 | framework: 'jasmine',
17 | jasmineNodeOpts: {
18 | showColors: true,
19 | defaultTimeoutInterval: 30000,
20 | print: function() {}
21 | },
22 | onPrepare() {
23 | require('ts-node').register({
24 | project: require('path').join(__dirname, './tsconfig.e2e.json')
25 | });
26 | jasmine.getEnv().addReporter(new SpecReporter({ spec: { displayStacktrace: true } }));
27 | }
28 | };
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { BrowserModule } from '@angular/platform-browser';
2 | import { NgModule } from '@angular/core';
3 | import { FormsModule } from '@angular/forms';
4 | import { AppRoutingModule } from './app-routing.module';
5 | import { AppComponent } from './app.component';
6 | import { CreateEmployeeComponent } from './create-employee/create-employee.component';
7 | import { EmployeeDetailsComponent } from './employee-details/employee-details.component';
8 | import { EmployeeListComponent } from './employee-list/employee-list.component';
9 | import { HttpClientModule } from '@angular/common/http';
10 | @NgModule({
11 | declarations: [
12 | AppComponent,
13 | CreateEmployeeComponent,
14 | EmployeeDetailsComponent,
15 | EmployeeListComponent
16 | ],
17 | imports: [
18 | BrowserModule,
19 | AppRoutingModule,
20 | FormsModule,
21 | HttpClientModule
22 | ],
23 | providers: [],
24 | bootstrap: [AppComponent]
25 | })
26 | export class AppModule { }
27 |
--------------------------------------------------------------------------------
/angular-6-springboot-client/src/app/employee.service.ts:
--------------------------------------------------------------------------------
1 | import { Injectable } from '@angular/core';
2 | import { HttpClient } from '@angular/common/http';
3 | import { Observable } from 'rxjs';
4 |
5 | @Injectable({
6 | providedIn: 'root'
7 | })
8 | export class EmployeeService {
9 |
10 | private baseUrl = '/api/v1/employees';
11 |
12 | constructor(private http: HttpClient) { }
13 |
14 | getEmployee(id: number): Observable