import { Component , OnInit } from '@angular/core' ; import { Stock , StocksService } from "../../../../services/items.service" ; import { MdDialogRef } from '@angular/material' ; @ Component ( { selector : 'app-stock-edit' , templateUrl : './stock-edit.component.html' , styleUrls : [ './stock-edit.component.scss' ] } ) export class StockEditComponent implements OnInit { stock : Stock ; constructor ( public dialogRef , private _stockService ) { } ngOnInit ( ) { } close ( stock ? ) { this . dialogRef . close ( stock ) ; } saveState ( ) { this . stock . default_stock = false ; this . _stockService . update ( this . stock . id , this . stock ) . subscribe ( ( data ) => { this . close ( this . stock ) ; } , ( ) => { } ) ; } }