+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 +25 +26 +27 +28 +29 +30 | + + + + + + + + + + + +1x +2x + + +2x +2x + + + + + + + + + + + + | import { Component, OnInit } from '@angular/core';
+import { UserregistrationService } from './users/services/userregistrationservice/userregistration.service';
+import { User } from './users/models/user';
+import { HttpErrorResponse } from '@angular/common/http';
+
+@Component({
+ selector: 'app-root',
+ templateUrl: './app.component.html',
+ styleUrls: ['./app.component.css']
+})
+
+//Implementing OnInit will call ngOnInit function when the component is initialized.
+export class AppComponent implements OnInit {
+ title = 'socialseriveapp';
+ public users: User[];
+
+ constructor(private userRegistrationService: UserregistrationService) {
+ this.users = [];
+ }
+
+ ngOnInit(): void { }
+
+ public getUsers(): void {
+ this.userRegistrationService.getUser().subscribe({
+ next: (response: User[]) => { this.users = response },
+ error: (error: HttpErrorResponse) => { console.log(error.message) }
+ });
+ }
+}
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 | + + + + + + +1x + + + + + + + | import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-contactus',
+ templateUrl: './contactus.component.html',
+ styleUrls: ['./contactus.component.css']
+})
+export class ContactusComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+}
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| contactus.component.ts | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 | + + + + + + +1x + + + + + + | import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-homepage',
+ templateUrl: './homepage.component.html',
+ styleUrls: ['./homepage.component.css']
+})
+export class HomepageComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+} |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| homepage.component.ts | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| app.component.ts | +
+
+ |
+ 62.5% | +5/8 | +100% | +0/0 | +20% | +1/5 | +57.14% | +4/7 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| navbar.component.ts | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 | + + + + + + +1x + + + + + + + + | import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-navbar',
+ templateUrl: './navbar.component.html',
+ styleUrls: ['./navbar.component.css']
+})
+export class NavbarComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| registration-form.component.ts | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 | + + + + + + +1x + + + + + + + + | import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-registration-form',
+ templateUrl: './registration-form.component.html',
+ styleUrls: ['./registration-form.component.css']
+})
+export class RegistrationFormComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit(): void {
+ }
+
+}
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| userregistration.service.ts | +
+
+ |
+ 66.66% | +4/6 | +100% | +0/0 | +33.33% | +1/3 | +60% | +3/5 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 +19 +20 +21 +22 +23 +24 | + + + + + + + + + +1x + +2x +2x + + + + + + + + + + | import { Injectable } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { Observable } from 'rxjs';
+import { User } from '../../models/user';
+import { environment } from 'src/environments/environment';
+
+@Injectable({
+ providedIn: 'root'
+})
+
+export class UserregistrationService {
+
+ private apiServerUrl = environment.baseUrl;
+ constructor(private http: HttpClient){ }
+
+ public getUser(): Observable<User[]>{
+ return this.http.get<User[]>(`${this.apiServerUrl}/user`);
+ }
+
+ public addUser(User: User): Observable<User>{
+ return this.http.post<User>(`${this.apiServerUrl}/addUser`, User);
+ }
+}
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| 1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 +15 +16 +17 +18 | + + + +1x + + + + + + + + + + + + + | // This file can be replaced during build by using the `fileReplacements` array.
+// `ng build` replaces `environment.ts` with `environment.prod.ts`.
+// The list of file replacements can be found in `angular.json`.
+
+export const environment = {
+ production: false,
+ baseUrl: `http://localhost:8080/api/v1`
+};
+
+/*
+ * For easier debugging in development mode, you can import the following file
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
+ *
+ * This import should be commented out in production mode because it will have a negative impact
+ * on performance if an error is thrown.
+ */
+// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
+ |
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| environment.ts | +
+
+ |
+ 100% | +1/1 | +100% | +0/0 | +100% | +0/0 | +100% | +1/1 | +
+ Press n or j to go to the next uncovered block, b, p or k for the previous block. +
+ +| File | ++ | Statements | ++ | Branches | ++ | Functions | ++ | Lines | ++ |
|---|---|---|---|---|---|---|---|---|---|
| app | +
+
+ |
+ 62.5% | +5/8 | +100% | +0/0 | +20% | +1/5 | +57.14% | +4/7 | +
| app/homepage | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
| app/homepage/contactus | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
| app/layout/navbar | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
| app/registration-form | +
+
+ |
+ 100% | +2/2 | +100% | +0/0 | +100% | +2/2 | +100% | +1/1 | +
| app/users/services/userregistrationservice | +
+
+ |
+ 66.66% | +4/6 | +100% | +0/0 | +33.33% | +1/3 | +60% | +3/5 | +
| environments | +
+
+ |
+ 100% | +1/1 | +100% | +0/0 | +100% | +0/0 | +100% | +1/1 | +