Skip to content

Instantly share code, notes, and snippets.

@Vallabharayudu
Last active December 3, 2018 10:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Vallabharayudu/d0b3d10630d96685ce495171ac7b7f06 to your computer and use it in GitHub Desktop.
Save Vallabharayudu/d0b3d10630d96685ce495171ac7b7f06 to your computer and use it in GitHub Desktop.
<template>
<require from="styles.css"></require>
<h1>${message}</h1>
<div class="container">
<ul>
<li repeat.for="item of list" class="${item.isActive?'red':''}" click.delegate="clickItem(item)">${item.name}</li>
</ul>
</div>
</template>
export class App {
message = 'Hello World!';
constructor(){
this.list = new Array();
this.list.push(new Listitems('Vallabha',false));
this.list.push(new Listitems('Mohan',false));
this.list.push(new Listitems('Pranay',false));
this.list.push(new Listitems('Ganapathi',false));
}
clickItem(selectedItem){
var targetIndex = this.list.indexOf(selectedItem);
//for(var i=0;i<this.list.length; i++){
//this.list[i].isActive = false;
//}
this.list.forEach((item) => item.isActive = false)
this.list[targetIndex].isActive = true;
}
}
export class Listitems {
constructor(name,isActive){
this.name = name;
this.isActive = isActive;
}
}
<!doctype html>
<html>
<head>
<title>Aurelia</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body aurelia-app>
<h1>Loading...</h1>
<!--<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>-->
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/jspm_packages/system.js"></script>
<script src="https://cdn.rawgit.com/jdanyow/aurelia-bundle/v1.0.3/config.js"></script>
<script>
System.import('aurelia-bootstrapper');
</script>
</body>
</html>
console.log('Hello World!');
/* todo: add styles */
.red{
color:red;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment