Last active
August 10, 2016 19:41
-
-
Save fabioluz/bcd7841ed21616136d5b6ab259a9d9c2 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="./language-switcher"></require> | |
<language-switcher languages.bind="languages" selected-language.two-way="selectedLanguage"> | |
</language-switcher> | |
<br><br> | |
${selectedLanguage.shortName} | |
</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 { | |
someMessage = 'My message here'; | |
languages = [ { shortName: 'EN', id: 1 }, { shortName: 'PT', id: 2 }]; | |
selectedLanguage = this.languages[1]; | |
} |
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
<template> | |
<form role="language" class="navbar-form navbar-left m-t-1"> | |
<div class="input-group"> | |
<select value.bind="selectedLanguage" change.delegate="switchLanguage()" matcher.bind="languageMatcher" class="form-control"> | |
<option repeat.for="language of languages" model.bind="language">${language.shortName}</option> | |
</select> | |
</div> | |
</form> | |
</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
import {inject, customElement, bindable} from 'aurelia-framework'; | |
// import {I18N} from 'aurelia-i18n'; | |
import {Router} from 'aurelia-router'; | |
// import {HubFactory} from 'service'; | |
// import {hub} from 'enums'; | |
@customElement('language-switcher') | |
@inject(Element, Router) | |
export class LanguageSwitcher { | |
languageMatcher = (a, b) => {console.log(a,b); a.id === b.id;} | |
@bindable languages; | |
@bindable selectedLanguage; | |
constructor(element, router) { | |
this.element = element; | |
// this.i18n = i18n; | |
// this.router = router; | |
// this.usmHub = hubFactory.getHub(hub.usersSessionManagementHub); | |
} | |
switchLanguage() { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment