Created
September 5, 2019 11:57
-
-
Save debugmodedotnet/47ef5fe4ed81a2f941127c588d4796d5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component, OnInit } from '@angular/core'; | |
@Component({ | |
selector: 'app-root', | |
templateUrl: './app.component.html', | |
styleUrls: ['./app.component.css'] | |
}) | |
export class AppComponent implements OnInit { | |
showDetails= false; | |
buyButton = false; | |
tshirts = []; | |
tshirtdetails: any; | |
addtocart(t){ | |
this.tshirtdetails = t; | |
this.showDetails = true; | |
this.buyButton = true; | |
} | |
cancel(d){ | |
this.showDetails = false; | |
this.buyButton = false; | |
} | |
update(d):void{ | |
console.log(d.Id); | |
this.showDetails = false; | |
this.buyButton = false; | |
} | |
ngOnInit() { | |
this.tshirts = this.getTShirts(); | |
console.log(this.tshirts); | |
} | |
getTShirts() { | |
return [ | |
{ | |
"Id": 1, | |
"name": "Man White T-Shirt", | |
"productCode": "MAN-0011", | |
"releaseDate": "March 19, 2019", | |
"description": "A White T-Shirt for office going men", | |
"price": 300, | |
"quanity": 40, | |
"color": "white", | |
"fimage": "assets/images/t1front.jpg", | |
"bimage": "assets/images/t1back.jpg", | |
"size" : "large", | |
"imggsrc":'' | |
}, | |
{ | |
"Id": 2, | |
"name": "Sports Red T-Shirt", | |
"productCode": "REDMAN-0011", | |
"releaseDate": "April 19, 2018", | |
"description": "A Red T-Shirt for office going men", | |
"price": 300, | |
"quanity": 40, | |
"color": "Red", | |
"fimage": "assets/images/t2front.jpg", | |
"bimage": "assets/images/t2back.jpg", | |
"size" : "Medium", | |
"imggsrc":'' | |
}, | |
{ | |
"Id": 3, | |
"name": "Girl Pink T-Shirt", | |
"productCode": "GIRL-0011", | |
"releaseDate": "July 19, 2018", | |
"description": "A Pink T-Shirt for girl", | |
"price": 400, | |
"quanity": 15, | |
"color": "pink", | |
"fimage": "assets/images/t3front.jpg", | |
"bimage": "assets/images/t3back.jpg", | |
"size" : "small", | |
"imggsrc":'' | |
}, | |
{ | |
"Id": 4, | |
"name": "Man White T-Shirt", | |
"productCode": "MAN-0011", | |
"releaseDate": "March 19, 2019", | |
"description": "A White T-Shirt for office going men.", | |
"price": 300, | |
"quanity": 40, | |
"color": "white", | |
"fimage": "assets/images/t1front.jpg", | |
"bimage": "assets/images/t1back.jpg", | |
"size" : "large", | |
"imggsrc":'' | |
}, | |
{ | |
"Id": 5, | |
"name": "Sports Red T-Shirt", | |
"productCode": "REDMAN-0011", | |
"releaseDate": "April 19, 2018", | |
"description": "A Red T-Shirt for office going men", | |
"price": 300, | |
"quanity": 40, | |
"color": "Red", | |
"fimage": "assets/images/t2front.jpg", | |
"bimage": "assets/images/t2back.jpg", | |
"size" : "Medium", | |
"imggsrc":'' | |
}, | |
{ | |
"Id": 6, | |
"name": "Girl Pink T-Shirt", | |
"productCode": "GIRL-0011", | |
"releaseDate": "July 19, 2018", | |
"description": "A Pink T-Shirt for girl", | |
"price": 400, | |
"quanity": 15, | |
"color": "pink", | |
"fimage": "assets/images/t3front.jpg", | |
"bimage": "assets/images/t3back.jpg", | |
"size" : "small", | |
"imggsrc":'' | |
}, | |
] | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment