Created
June 12, 2017 22:49
-
-
Save plwalters/493661f65fbd54b8e5eb1cf15462a1d0 to your computer and use it in GitHub Desktop.
DI inheritance
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> | |
<h1>${message}</h1> | |
</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 { message = 'Hello World'; } |
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://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
export class TwoDecimalValueConverter { | |
toView(value) { | |
if(typeof value === 'string') { | |
if(!value) return value; | |
let numValue = Number(value); | |
if(isNaN(numValue)) return value; | |
value = numValue; | |
} | |
if(typeof value === 'number') { | |
return value.toFixed(2); | |
} | |
return value; | |
} | |
fromView(value) { | |
if (typeof value !== 'string') { | |
return value; | |
} | |
var num = Number(value); | |
if (isNaN(num)) { | |
return null; | |
} | |
if (value.indexOf('.') > -1) { | |
return num; | |
} | |
if (num >= 100) num /= 100; | |
return num; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment