Skip to content

Instantly share code, notes, and snippets.

View debugmodedotnet's full-sized avatar

Dhananjay Kumar debugmodedotnet

View GitHub Profile
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements OnInit {
<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">&times;</span>
</button>
</div>
<div class="card-body">
<div class="container">
<div class="page-header">
<h1 class="text-danger text-center">Foo T-Shirt Company</h1>
</div>
<hr />
<br />
<div class="row">
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,
changeName = function () {
dbrepo.name = 'set by code ';
}
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;
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
}
function addToScope(){
if(!dbrepo.hasOwnProperty(bindingProperty)){
let value;
Object.defineProperty(dbrepo,bindingProperty,{
configurable:true,
enumerable:true ,
set: function(newvalue){
value = newvalue;
},
function addToScope(){
if(!dbrepo.hasOwnProperty(bindingProperty)){
let value;
Object.defineProperty(dbrepo,bindingProperty,{
configurable:true,
enumerable:true ,
set: function(newvalue){
value = newvalue;
},
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);
}
});