",
+ "request": "launch",
+ "cwd": "${workspaceFolder}",
+ "console": "internalConsole",
+ "mainClass": "org.gcube.app.springbootangulardemo.SpringbootAngularAppDemoApplication",
+ "projectName": "springboot-angular-app-demo",
+ "args": ""
+ }
+ ]
+}
\ No newline at end of file
diff --git a/src/main/ng-app/src/app/app-routing.module.ts b/src/main/ng-app/src/app/app-routing.module.ts
index 06c7342..7ea5b4e 100644
--- a/src/main/ng-app/src/app/app-routing.module.ts
+++ b/src/main/ng-app/src/app/app-routing.module.ts
@@ -2,7 +2,12 @@ import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
-const routes: Routes = [];
+import { MyFirstCAngularComponent } from './my-first-c-angular/my-first-c-angular.component';
+
+const routes: Routes = [
+ //{path: '', component: HelloWorldComponent},
+ {path: '', component: MyFirstCAngularComponent},
+];
@NgModule({
imports: [RouterModule.forRoot(routes)],
diff --git a/src/main/ng-app/src/app/app.component.ts b/src/main/ng-app/src/app/app.component.ts
index b090bea..7c7c56f 100644
--- a/src/main/ng-app/src/app/app.component.ts
+++ b/src/main/ng-app/src/app/app.component.ts
@@ -6,5 +6,5 @@ import { Component } from '@angular/core';
styleUrls: ['./app.component.css']
})
export class AppComponent {
- title = 'ng-app';
+ title = 'ng-app created by guide "Building a Web App using Spring Boot and Angular9-CLI with Maven"';
}
diff --git a/src/main/ng-app/src/app/app.module.ts b/src/main/ng-app/src/app/app.module.ts
index 2c3ba29..8afba39 100644
--- a/src/main/ng-app/src/app/app.module.ts
+++ b/src/main/ng-app/src/app/app.module.ts
@@ -3,16 +3,25 @@ import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
+import { MyFirstCAngularComponent } from './my-first-c-angular/my-first-c-angular.component';
+import { HttpClientModule } from '@angular/common/http';
+import { MyFirstSAngularService } from './service/my-first-s-angular.service';
@NgModule({
declarations: [
- AppComponent
+ AppComponent,
+ MyFirstCAngularComponent
],
imports: [
- BrowserModule,
- AppRoutingModule
+ BrowserModule,
+ AppRoutingModule,
+ HttpClientModule
],
- providers: [],
- bootstrap: [AppComponent]
+ providers: [
+ MyFirstSAngularService
+ ],
+ bootstrap: [
+ AppComponent
+ ]
})
export class AppModule { }
diff --git a/src/main/ng-app/src/app/model/my-first-angular-greeting-model-class.ts b/src/main/ng-app/src/app/model/my-first-angular-greeting-model-class.ts
new file mode 100644
index 0000000..a3ccba9
--- /dev/null
+++ b/src/main/ng-app/src/app/model/my-first-angular-greeting-model-class.ts
@@ -0,0 +1,12 @@
+/*
+* This class is a model for mapping the Greeting.java
+* provided by Spring
+*/
+export class MyFirstAngularGreetingModelClass {
+ id: number;
+ content: string;
+ constructor(private _id: number, public message: string) {
+ this.id = _id;
+ this.content = message;
+ }
+}
diff --git a/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.css b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.css
new file mode 100644
index 0000000..e69de29
diff --git a/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.html b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.html
new file mode 100644
index 0000000..75d6818
--- /dev/null
+++ b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.html
@@ -0,0 +1,3 @@
+
+ This is a message from server ->
{{this.welcomeMessage}}
+
diff --git a/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.spec.ts b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.spec.ts
new file mode 100644
index 0000000..325b68d
--- /dev/null
+++ b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.spec.ts
@@ -0,0 +1,28 @@
+/* tslint:disable:no-unused-variable */
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { By } from '@angular/platform-browser';
+import { DebugElement } from '@angular/core';
+
+import { MyFirstCAngularComponent } from './my-first-c-angular.component';
+
+describe('MyFirstCAngularComponent', () => {
+ let component: MyFirstCAngularComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ MyFirstCAngularComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(MyFirstCAngularComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.ts b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.ts
new file mode 100644
index 0000000..c7d5bce
--- /dev/null
+++ b/src/main/ng-app/src/app/my-first-c-angular/my-first-c-angular.component.ts
@@ -0,0 +1,22 @@
+import { Component, OnInit } from '@angular/core';
+import { Router, ActivatedRoute } from '@angular/router';
+import { MyFirstSAngularService } from '../service/my-first-s-angular.service';
+
+@Component({
+ selector: 'app-my-first-c-angular',
+ templateUrl: './my-first-c-angular.component.html',
+ styleUrls: ['./my-first-c-angular.component.css']
+})
+export class MyFirstCAngularComponent implements OnInit {
+
+ welcomeMessage = '';
+
+ constructor(private myFirstAnguluarService: MyFirstSAngularService) { }
+
+ ngOnInit() {
+ this.myFirstAnguluarService.executeMyFirstHttpCall().subscribe((res) => {
+ this.welcomeMessage = res.content;
+ });
+ }
+
+}
diff --git a/src/main/ng-app/src/app/service/my-first-s-angular.service.spec.ts b/src/main/ng-app/src/app/service/my-first-s-angular.service.spec.ts
new file mode 100644
index 0000000..397745d
--- /dev/null
+++ b/src/main/ng-app/src/app/service/my-first-s-angular.service.spec.ts
@@ -0,0 +1,16 @@
+/* tslint:disable:no-unused-variable */
+
+import { TestBed, async, inject } from '@angular/core/testing';
+import { MyFirstSAngularService } from './my-first-s-angular.service';
+
+describe('Service: MyFirstSAngular', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [MyFirstSAngularService]
+ });
+ });
+
+ it('should ...', inject([MyFirstSAngularService], (service: MyFirstSAngularService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/src/main/ng-app/src/app/service/my-first-s-angular.service.ts b/src/main/ng-app/src/app/service/my-first-s-angular.service.ts
new file mode 100644
index 0000000..e069c9f
--- /dev/null
+++ b/src/main/ng-app/src/app/service/my-first-s-angular.service.ts
@@ -0,0 +1,15 @@
+import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { MyFirstAngularGreetingModelClass } from '../model/my-first-angular-greeting-model-class';
+
+@Injectable({
+ providedIn: 'root'
+})
+export class MyFirstSAngularService {
+
+ constructor(private http: HttpClient) { }
+
+ executeMyFirstHttpCall() {
+ return this.http.get('http://localhost:8080/api/greeting-obj');
+ }
+}
diff --git a/target/classes/META-INF/maven/org.gcube.app/springboot-angular-app-demo/pom.properties b/target/classes/META-INF/maven/org.gcube.app/springboot-angular-app-demo/pom.properties
index 1da56fb..67473bd 100644
--- a/target/classes/META-INF/maven/org.gcube.app/springboot-angular-app-demo/pom.properties
+++ b/target/classes/META-INF/maven/org.gcube.app/springboot-angular-app-demo/pom.properties
@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
-#Mon Mar 09 13:17:17 CET 2020
+#Mon Mar 09 15:50:13 CET 2020
version=0.0.1-SNAPSHOT
groupId=org.gcube.app
m2e.projectName=springboot-angular-app-demo-0.0.1-SNAPSHOT