/** * @Component Name: FulcartComponent * @Module: Home * @Module Functionality : To display the full cart section * @Creation Date: August 12,2017 * @Author: sbaireddy * @Version: 1.0 */ import { Component, Input, OnInit, OnDestroy, ViewChild } from '@angular/core'; import { Router, ActivatedRoute } from '@angular/router'; import { NgClass } from '@angular/common'; import * as Constants from '../../shared/constants'; import { Cart } from '../../shared/modal/cart'; import { SharedService } from '../../shared/shared.service'; import { UserService } from '../../services/user.service'; import { CartService } from '../../services/cart.service'; @Component({ selector: 'fullcart-cmp', moduleId: module.id, templateUrl: 'fullcart.component.html', styleUrls: ['fullcart.component.css'] }) export class FullcartComponent implements OnInit, OnDestroy { storeId: number; // update storeid refTypeExchange: string = Constants.REF_TYPE_EXCHANGE; switchView: boolean = false; cart: Cart; // canOverrideRemorse constructor( public router: Router, public sharedService: SharedService, public userService: UserService, public cartService: CartService) { } /** * This function is used to initialize the directive/component after Angular * first displays the data-bound properties.It is invoked only once when the * directive is instantiated. * @returns void */ ngOnInit(): void { const METHOD_NAME: string = 'ngOnInit()'; this.sharedService.updateErrorMessage(null); this.cart = this.cartService.getCart(); } /** * Cleanup just before Angular destroys the directive/component. * Unsubscribe Observables and detach event handlers to avoid memory leaks. * @returns void */ ngOnDestroy(): void { this.cart = null; } }