Skip to content

Instantly share code, notes, and snippets.

@AshleyGrant
Forked from lstarky/app.html
Last active February 12, 2017 23:28
Show Gist options
  • Save AshleyGrant/1a66d5495314b06e378062610bd8da80 to your computer and use it in GitHub Desktop.
Save AshleyGrant/1a66d5495314b06e378062610bd8da80 to your computer and use it in GitHub Desktop.
Displaying the Json result in Table with some logic
<template>
<div class="container-fluid">
<div class="container-fluid">
<h1>Bootstrap Method (Responsive)</h1>
<p><i>The second column will wrap down below on smaller screens...
if you see it in one column, try widening the screen</i></p>
<div class="row">
<div class="col-xs-6">
<div repeat.for="field of myData | odds">
<p><b>${field.Key}:</b> ${field.value}</p>
</div>
</div>
<div class="col-xs-6">
<div repeat.for="field of myData | evens">
<p><b>${field.Key}:</b> ${field.value}</p>
</div>
</td>
</div>
</div>
</template>
export class App {
myData = [{
"Key": "Name",
"value": "Sriram",
"order": "01"
}, {
"Key": "Email",
"value": "sriram@gmail",
"order": "02"
}, {
"Key": "Genader",
"value": "male",
"order": "03"
}, {
"Key": "DOB",
"value": "01-01-88",
"order": "04"
}, {
"Key": "MobileNo",
"value": "999999999",
"order": "05"
}, "Key": "Address", "value": "", "order": "06"
}];
}
export class EvensValueConverter {
toView(value) {
return value.filter( x => parseInt(x.order) % 2 === 0 );
}
}
export class OddsValueConverter {
toView(value) {
return value.filter( x => parseInt(x.order) % 2 === 1 );
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body aurelia-app="main">
<script src="https://jdanyow.github.io/rjs-bundle/node_modules/requirejs/require.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/config.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/aurelia.js"></script>
<script src="https://jdanyow.github.io/rjs-bundle/bundles/babel.js"></script>
<script>
require(['aurelia-bootstrapper']);
</script>
</body>
</html>
export function configure(aurelia) {
aurelia.use
.standardConfiguration()
.developmentLogging();
aurelia.start().then(() => aurelia.setRoot());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment