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 { |
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
<div class="card text-center"> | |
<img class="img-fluid" [src]="tshirt.fimage"/> | |
<div class="card-header"> | |
{{tshirt.name}} | |
<button (click)='cancel()' type="button" class="close" aria-label="Close"> | |
<span aria-hidden="true">×</span> | |
</button> | |
</div> | |
<div class="card-body"> |
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
<div class="container"> | |
<div class="page-header"> | |
<h1 class="text-danger text-center">Foo T-Shirt Company</h1> | |
</div> | |
<hr /> | |
<br /> | |
<div class="row"> |
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
getProducts() { | |
return [ | |
{ | |
"productId": 1, | |
"productName": "Leaf Rake", | |
"productCode": "GDN-0011", | |
"releaseDate": "March 19, 2019", | |
"description": "Leaf rake with 48-inch wooden handle.", | |
"price": 19.95, | |
"starRating": 3.2, |
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
changeName = function () { | |
dbrepo.name = 'set by code '; | |
} |
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
var elements = document.querySelectorAll('[data-geek97-bind]'); | |
var dbrepo = {}; | |
elements.forEach((element) => { | |
if (element.type === 'text') { | |
var bindingProperty = element.getAttribute('data-geek97-bind'); | |
addToScope(); | |
element.onkeyup = () => { | |
dbrepo[bindingProperty] = element.value; |
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
set: function (newvalue) { | |
value = newvalue; | |
elements.forEach(e => { | |
if (e.getAttribute('data-geek97-bind') === bindingProperty) { | |
if (e.type === 'text') { | |
e.value = newvalue | |
} | |
else if (!e.type) { | |
e.innerHTML = newvalue | |
} |
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
function addToScope(){ | |
if(!dbrepo.hasOwnProperty(bindingProperty)){ | |
let value; | |
Object.defineProperty(dbrepo,bindingProperty,{ | |
configurable:true, | |
enumerable:true , | |
set: function(newvalue){ | |
value = newvalue; | |
}, |
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
function addToScope(){ | |
if(!dbrepo.hasOwnProperty(bindingProperty)){ | |
let value; | |
Object.defineProperty(dbrepo,bindingProperty,{ | |
configurable:true, | |
enumerable:true , | |
set: function(newvalue){ | |
value = newvalue; | |
}, |
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
var elements = document.querySelectorAll('[data-geek97-bind]'); | |
var dbrepo = {}; | |
elements.forEach((element)=>{ | |
if(element.type === 'text'){ | |
let bindingProperty = element.getAttribute('data-geek97-bind'); | |
console.log(bindingProperty); | |
} | |
}); |