Skip to content

Commit 676ba79

Browse files
committed
Changes to make SPA compatible with angular-cli AOT
Signed-off-by: André Passos <andre-ap2@hotmail.com>
1 parent fe1216d commit 676ba79

11 files changed

Lines changed: 45 additions & 23 deletions

File tree

src/Web/WebSPA/Client/modules/app.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { ConfigurationService } from './shared/services/configuration.service';
1818
templateUrl: './app.component.html'
1919
})
2020
export class AppComponent implements OnInit {
21-
private Authenticated: boolean = false;
21+
Authenticated: boolean = false;
2222
subscription: Subscription;
2323

2424
constructor(private titleService: Title, private securityService: SecurityService, private configurationService: ConfigurationService) {

src/Web/WebSPA/Client/modules/basket/basket-status/basket-status.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[routerLink]="['basket']">
44

55
<div class="esh-basketstatus-image">
6-
<img src="../../../images/cart.png" />
6+
<img src="assets/images/cart.png" />
77
</div>
88
<div class="esh-basketstatus-badge">
99
{{badge}}

src/Web/WebSPA/Client/modules/orders/orders-detail/orders-detail.component.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Component, OnInit } from '@angular/core';
2-
import { OrdersService } from '../orders.service';
3-
import { IOrder } from '../../shared/models/order.model';
1+
import { Component, OnInit } from '@angular/core';
2+
import { OrdersService } from '../orders.service';
3+
import { IOrderDetail } from '../../shared/models/order-detail.model';
44
import { ActivatedRoute } from '@angular/router';
55

66
@Component({
@@ -9,7 +9,7 @@ import { ActivatedRoute } from '@angular/router';
99
templateUrl: './orders-detail.component.html'
1010
})
1111
export class OrdersDetailComponent implements OnInit {
12-
order = {}; // new order
12+
public order: IOrderDetail = <IOrderDetail>{};
1313

1414
constructor(private service: OrdersService, private route: ActivatedRoute) { }
1515

@@ -27,5 +27,4 @@ export class OrdersDetailComponent implements OnInit {
2727
console.log(this.order);
2828
});
2929
}
30-
}
31-
30+
}

src/Web/WebSPA/Client/modules/orders/orders-new/orders-new.component.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import { Router } from '@angular/router';
1313
templateUrl: './orders-new.component.html'
1414
})
1515
export class OrdersNewComponent implements OnInit {
16-
private newOrderForm: FormGroup; // new order form
17-
private isOrderProcessing: Boolean;
18-
private errorReceived: Boolean;
19-
private order: IOrder;
16+
newOrderForm: FormGroup; // new order form
17+
isOrderProcessing: boolean;
18+
errorReceived: boolean;
19+
order: IOrder;
2020

2121
constructor(private service: OrdersService, fb: FormBuilder, private router: Router) {
2222
// Obtain user profile information

src/Web/WebSPA/Client/modules/orders/orders.service.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { Response } from '@angular/http';
44
import { DataService } from '../shared/services/data.service';
55
import { IOrder } from '../shared/models/order.model';
66
import { IOrderItem } from '../shared/models/orderItem.model';
7+
import { IOrderDetail } from "../shared/models/order-detail.model";
78
import { SecurityService } from '../shared/services/security.service';
89
import { ConfigurationService } from '../shared/services/configuration.service';
910
import { BasketWrapperService } from '../shared/services/basket.wrapper.service';
@@ -35,7 +36,7 @@ export class OrdersService {
3536
});
3637
}
3738

38-
getOrder(id: number): Observable<IOrder> {
39+
getOrder(id: number): Observable<IOrderDetail> {
3940
let url = this.ordersUrl + '/api/v1/orders/' + id;
4041

4142
return this.service.get(url).map((response: Response) => {

src/Web/WebSPA/Client/modules/shared/components/identity/identity.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*ngIf="authenticated">
1313

1414
<div class="esh-identity-name">{{userName}}</div>
15-
<img class="esh-identity-image" src="../../../../images/arrow-down.png">
15+
<img class="esh-identity-image" src="assets/images/arrow-down.png">
1616
</section>
1717

1818
<section class="esh-identity-drop"
@@ -22,14 +22,14 @@
2222
[routerLink]="['orders']">
2323

2424
<div class="esh-identity-name esh-identity-name--upper">My orders</div>
25-
<img class="esh-identity-image" src="../../../../images/my_orders.png">
25+
<img class="esh-identity-image" src="assets/images/my_orders.png">
2626
</div>
2727

2828
<div class="esh-identity-item"
2929
(click)="logoutClicked($event)">
3030

3131
<div class="esh-identity-name esh-identity-name--upper">Log Out</div>
32-
<img class="esh-identity-image" src="../../../../images/logout.png">
32+
<img class="esh-identity-image" src="assets/images/logout.png">
3333
</div>
3434
</section>
3535
</div>

src/Web/WebSPA/Client/modules/shared/components/identity/identity.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { SecurityService } from '../../services/security.service';
1010
styleUrls: ['./identity.scss']
1111
})
1212
export class Identity implements OnInit {
13-
private authenticated: boolean = false;
13+
authenticated: boolean = false;
1414
private subscription: Subscription;
1515
private userName: string = '';
1616

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import {IOrderItem} from './orderItem.model';
2+
3+
export interface IOrderDetail {
4+
ordernumber: string;
5+
status: string;
6+
street: string;
7+
date: Date;
8+
city: number;
9+
state: string;
10+
zipcode: string;
11+
country: number;
12+
total: number;
13+
orderitems: IOrderItem[];
14+
}

src/Web/WebSPA/Client/modules/shared/shared.module.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ import { StorageService } from './services/storage.service';
1616
import { Pager } from './components/pager/pager';
1717
import { Header } from './components/header/header';
1818
import { Identity } from './components/identity/identity';
19+
import { PageNotFoundComponent } from './components/page-not-found/page-not-found.component';
20+
21+
// Pipes:
22+
import { UppercasePipe } from './pipes/uppercase.pipe';
1923

2024
@NgModule({
2125
imports: [
@@ -31,7 +35,9 @@ import { Identity } from './components/identity/identity';
3135
declarations: [
3236
Pager,
3337
Header,
34-
Identity
38+
Identity,
39+
PageNotFoundComponent,
40+
UppercasePipe
3541
],
3642
exports: [
3743
// Modules
@@ -43,7 +49,9 @@ import { Identity } from './components/identity/identity';
4349
// Providers, Components, directive, pipes
4450
Pager,
4551
Header,
46-
Identity
52+
Identity,
53+
PageNotFoundComponent,
54+
UppercasePipe
4755
]
4856
})
4957
export class SharedModule {

src/Web/WebSPA/WebSPA.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656

5757
<Target Name="PrepublishScript" BeforeTargets="PrepareForPublish">
5858
<Exec Command="npm install" />
59-
<Exec Command="npm run build:dev" />
59+
<Exec Command="npm run build:prod" />
6060
</Target>
6161

6262
<ItemGroup>

0 commit comments

Comments
 (0)