Commit e9d23b7f00f503e12bfde4eff4cee1cefd327682
Exists in
master
and in
1 other branch
Merge branch 'master' into 'master'
Master(mpuebla) See merge request !39
Showing
3 changed files
Show diff stats
src/app/app-routing.module.ts
src/app/components/sidebar/sidebar.component.html
| ... | ... | @@ -52,8 +52,8 @@ |
| 52 | 52 | *ngIf="esPersonalizable(producto)" |
| 53 | 53 | type="button" |
| 54 | 54 | class="btn btn-light btn-sm my-auto float-left border shadow" |
| 55 | - (click)="personalizarPromo"> | |
| 56 | - <i class="fa fa-hand-o-up" aria-hidden="true"></i> | |
| 55 | + (click)="personalizarPromo(producto, i)"> | |
| 56 | + <i class="fa fa-refresh text-purple" aria-hidden="true"></i> | |
| 57 | 57 | </button> |
| 58 | 58 | </div> |
| 59 | 59 |
src/app/components/sidebar/sidebar.component.ts
| ... | ... | @@ -2,6 +2,7 @@ import { Component, OnInit } from '@angular/core'; |
| 2 | 2 | import { Producto } from 'src/app/wrappers/producto'; |
| 3 | 3 | import { appSettings } from 'src/etc/AppSettings'; |
| 4 | 4 | import { ProductoService } from 'src/app/services/producto.service'; |
| 5 | +import { Router } from '@angular/router'; | |
| 5 | 6 | |
| 6 | 7 | @Component({ |
| 7 | 8 | selector: 'app-sidebar', |
| ... | ... | @@ -18,7 +19,13 @@ export class SidebarComponent implements OnInit { |
| 18 | 19 | |
| 19 | 20 | public productosCarrito: Producto[] = []; |
| 20 | 21 | |
| 21 | - constructor(private productoService: ProductoService) { } | |
| 22 | + constructor( | |
| 23 | + private productoService: ProductoService, | |
| 24 | + private router: Router) { | |
| 25 | + this.router.routeReuseStrategy.shouldReuseRoute = function () { | |
| 26 | + return false; | |
| 27 | + } | |
| 28 | + } | |
| 22 | 29 | |
| 23 | 30 | ngOnInit() { |
| 24 | 31 | |
| ... | ... | @@ -80,4 +87,11 @@ export class SidebarComponent implements OnInit { |
| 80 | 87 | return esPersonalizable; |
| 81 | 88 | } |
| 82 | 89 | |
| 90 | + personalizarPromo(producto: Producto, index) { | |
| 91 | + | |
| 92 | + this.productoService.productoAcargar = producto; | |
| 93 | + this.deleteProducto(producto, index); | |
| 94 | + this.router.navigate(['inicio']); | |
| 95 | + } | |
| 96 | + | |
| 83 | 97 | } |