X-Git-Url: https://hackdaworld.org/gitweb/?p=outofuni%2Ftavern2.git;a=blobdiff_plain;f=lib%2Fproduct_category_component.dart;h=b7d3bf12f562bc0db73f564ee54d0ddce895fe67;hp=69633990e7f43e9f510363b8efed4011aa67f4f4;hb=b2028ca4879e48884436ee0c2aee7fae6ddaeb5a;hpb=8efc1c411ba4d97505c3836bd78bb5e68f521e2e diff --git a/lib/product_category_component.dart b/lib/product_category_component.dart index 6963399..b7d3bf1 100644 --- a/lib/product_category_component.dart +++ b/lib/product_category_component.dart @@ -22,26 +22,19 @@ import 'package:angular2_rbi/directives.dart'; class ProductCategoryComponent implements OnInit { List product_categories; ProductCategory selected_prod_category; - String new_prod_category_name; - String new_prod_category_id; + String new_prod_category_name=''; final ProductCategoryService _prodcatSrv; final Router _router; ProductCategoryComponent(this._prodcatSrv,this._router); - Future getProductCategories() async { - product_categories = await _prodcatSrv.getAll(); - } - Future createProductCategory() async { - await _prodcatSrv.createProdCategory( - new_prod_category_name, - new_prod_category_id - ); + await _prodcatSrv.createProdCategory(new_prod_category_name); + await ngOnInit(); } - void ngOnInit() { - getProductCategories(); + Future ngOnInit() async { + product_categories = await _prodcatSrv.getAll(); } choose(ProductCategory pt) {