-
-
Save deap82/303efec9b4d08191b083e6eeddc0cd58 to your computer and use it in GitHub Desktop.
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
<template> | |
<require from="./my-attr-options"></require> | |
<require from="./my-attr"></require> | |
<div my-attr my-attr-options="option1.bind: firstInstanceOpt"></div> | |
<div my-attr my-attr-options="option1.bind: secondInstanceOpt"></div> | |
<div my-attr></div> | |
</template> |
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
export class App { | |
opt1 = 'an option value'; | |
opt2 = 'another option value'; | |
firstInstanceOpt = 'first instance'; | |
secondInstanceOpt = 'second instance'; | |
} |
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
<!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> | |
</body> | |
</html> |
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 { bindable } from 'aurelia-framework'; | |
export class MyAttrOptionsCustomAttribute { | |
@bindable option1; | |
constructor() { | |
this.option1 = 'default 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
import { inject } from 'aurelia-framework'; | |
import { MyAttrOptionsCustomAttribute } from 'my-attr-options'; | |
@inject(MyAttrOptionsCustomAttribute) | |
export class MyAttrCustomAttribute { | |
constructor(myAttrOptions) { | |
this.myAttrOptions = myAttrOptions; | |
console.log('ctr', this.myAttrOptions.option1); | |
} | |
attached() { | |
console.log('attached', this.myAttrOptions.option1); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment