Created
September 7, 2017 11:39
-
-
Save adrianharabula/a49732ae81db6bd650ee812958d54bf7 to your computer and use it in GitHub Desktop.
JS Bin // source http://jsbin.com/lobiqon
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> | |
<meta charset="utf-8"> | |
<meta name="viewport" content="width=device-width"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<h2>Introdu venitul tău</h2> | |
<input data-bind="textInput: salar"/> <span data-bind="text: currency"></span>/lună <br /> <br /> | |
<input data-bind="textInput: period"/> <span data-bind="text: periodUnit"></span> <br /><br /> | |
Pentru venitul tau de <span data-bind="text: salar"></span><span data-bind="text: currency"></span>/lună. <br> | |
Asta ar însemna <span data-bind="text: showVenit"></span><span data-bind="text: currency"></span> pe o perioadă de <span data-bind="text: period"></span> <span data-bind="text: periodUnit"></span>. | |
<script src="https://cdnjs.cloudflare.com/ajax/libs/knockout/3.3.0/knockout-min.js"></script> | |
<script id="jsbin-javascript"> | |
function VenitViewModel() { | |
var self = this; | |
self.salar = ko.observable(4500); | |
self.currency = ko.observable('lei'); | |
self.period = ko.observable(12); | |
self.periodUnit = ko.observable('luni'); | |
self.showVenit = ko.computed(function() { | |
return self.salar()*self.period(); | |
}, self); | |
} | |
ko.applyBindings(new VenitViewModel()); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">function VenitViewModel() { | |
var self = this; | |
self.salar = ko.observable(4500); | |
self.currency = ko.observable('lei'); | |
self.period = ko.observable(12); | |
self.periodUnit = ko.observable('luni'); | |
self.showVenit = ko.computed(function() { | |
return self.salar()*self.period(); | |
}, self); | |
} | |
ko.applyBindings(new VenitViewModel());</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
function VenitViewModel() { | |
var self = this; | |
self.salar = ko.observable(4500); | |
self.currency = ko.observable('lei'); | |
self.period = ko.observable(12); | |
self.periodUnit = ko.observable('luni'); | |
self.showVenit = ko.computed(function() { | |
return self.salar()*self.period(); | |
}, self); | |
} | |
ko.applyBindings(new VenitViewModel()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment