-
-
Save Thanood/9a3de27aea854abd0ff091ca46d11790 to your computer and use it in GitHub Desktop.
Aurelia-Materialize bridge md-datepicker using icon
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> | |
<style> | |
[md-datepicker] + i.material-icons.std-icon-fixup { | |
margin-left: -24px; | |
line-height: 1; | |
margin-top: 12px; | |
cursor: pointer; | |
} | |
</style> | |
<h4>Using if.bind on the input - buggy</h4> | |
<button click.delegate="ifVisible = !ifVisible">SHOW/HIDE</button> | |
<div ref="dpWrapper"> | |
<input if.bind="ifVisible" md-datepicker="container.bind: dpWrapper; value.two-way: selectedDate; options.bind:advancedOptions;" type="date" placeholder="pick a date" /> | |
</div> | |
<h4>Using show.bind on the input - buggy</h4> | |
<button click.delegate="showVisible = !showVisible">SHOW/HIDE</button> | |
<div ref="dpWrapper2"> | |
<input show.bind="showVisible" md-datepicker="container.bind: dpWrapper2; value.two-way: selectedDate; options.bind:advancedOptions;" type="date" placeholder="pick a date" /> | |
</div> | |
<h4>Using if.bind on the div - buggy</h4> | |
<button click.delegate="ifVisibleDiv = !ifVisibleDiv">SHOW/HIDE</button> | |
<div ref="dpWrapper3" if.bind="ifVisibleDiv"> | |
<input md-datepicker="container.bind: dpWrapper3; value.two-way: selectedDate; options.bind:advancedOptions;" type="date" placeholder="pick a date" /> | |
</div> | |
<h4>Using show.bind on the div - Working</h4> | |
<button click.delegate="showVisibleDiv = !showVisibleDiv">SHOW/HIDE</button> | |
<div ref="dpWrapper4" show.bind="showVisibleDiv"> | |
<input md-datepicker="container.bind: dpWrapper4; value.two-way: selectedDate; options.bind:advancedOptions;" type="date" placeholder="pick a date" /> | |
</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 { | |
selectedDate; | |
advancedOptions = { | |
closeOnSelect: true, | |
closeOnClear: true, | |
selectYears: 50, | |
editable: true, | |
showIcon: true | |
}; | |
} |
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> | |
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet"> | |
<meta name="viewport" content="width=device-width, initial-scale=1"> | |
</head> | |
<body aurelia-app="main"> | |
<h1>Loading...</h1> | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.6/system.js"></script> | |
<script src="https://rawgit.com/aurelia-ui-toolkits/aurelia-materialize-bundles/0.25.0/config2.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
/******************************************************************************* | |
* The following two lines enable async/await without using babel's | |
* "runtime" transformer. Uncomment the lines if you intend to use async/await. | |
* | |
* More info here: https://github.com/jdanyow/aurelia-plunker/issues/2 | |
*/ | |
//import regeneratorRuntime from 'babel-runtime/regenerator'; | |
//window.regeneratorRuntime = regeneratorRuntime; | |
/******************************************************************************/ | |
import 'materialize'; | |
export function configure(aurelia) { | |
aurelia.use | |
.standardConfiguration() | |
.developmentLogging() | |
.plugin('aurelia-materialize-bridge', bridge => bridge.useAll() ); | |
aurelia.start().then(a => a.setRoot()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment