Skip to content

Instantly share code, notes, and snippets.

@TylerJPresley
Created March 14, 2017 20:52
Show Gist options
  • Save TylerJPresley/b56350417325a3972e07b4f3291faa77 to your computer and use it in GitHub Desktop.
Save TylerJPresley/b56350417325a3972e07b4f3291faa77 to your computer and use it in GitHub Desktop.
DI inheritance
<template>
<h1>${message}</h1>
<table border="1">
<tbody>
<template repeat.for="item of items" containerless>
<tr>
<td>${item.id}</td>
<td>${item.name}</td>
</tr>
<tr if.bind="item.summary !== ''">
<td colspan="2">${item.summary}</td>
</tr>
</template>
</tbody>
</table>
</template>
export class App {
message = 'Hello World';
items = [
{ id: 1, name: "blah 1", summary: "yay blah blah 11111" },
{ id: 2, name: "blah 2", summary: "yay blah blah 22222" },
{ id: 3, name: "blah 3", summary: "yay blah blah 33333" }
];
}
import {inject} from 'aurelia-dependency-injection'
export class Action1Dependency {}
export class Action2Dependency {}
export class ActionBase{
}
@inject(Action1Dependency)
export class Action1 extends ActionBase{
constructor(dep){
super();
this.dep = dep;
}
}
@inject(Action2Dependency)
export class Action2 extends ActionBase{
constructor(dep){
super();
this.dep = dep;
}
}
<!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://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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment