-
-
Save jwx/4c4a775d8b491589be0c4d8d3f9f3258 to your computer and use it in GitHub Desktop.
Custom element value binding
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> | |
<div if.bind="!question.alias || !question.alias.length"> | |
<label>Texte des réponses <a click.delegate="addAlias(question)"><i class="fa fa-plus-square-o"></i></a></label> | |
<span>aucun text</span> | |
</div> | |
<div if.bind="question.alias && question.alias.length"> | |
<label>Texte des réponses <a click.delegate="delAlias(question)"><i class="fa fa-trash-o" aria-hidden="true"></i></a></label> | |
<span repeat.for="alias of question.alias"><input style="text-align:center" value.bind="question.alias[$index]" /></span> | |
</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 { | |
question = { | |
values:[] | |
}; | |
attached() { | |
setTimeout(() => { this.question['alias'] = [] }, 3000) | |
setTimeout(() => { this.question.alias.push("added one text")}, 5000) | |
} | |
} |
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"> | |
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"> | |
</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> |
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 {Aurelia} from "aurelia-framework"; | |
import environment from "./environment"; | |
import {UIConfig} from "aurelia-ui-framework"; | |
export function configure(aurelia: Aurelia) { | |
aurelia.use | |
.standardConfiguration(); | |
aurelia.start().then(() => aurelia.setRoot()); | |
} |
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
/* todo: add styles */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment