/
web-DG-services-2.php
48 lines (46 loc) · 1.98 KB
/
web-DG-services-2.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->
<html>
<head>
<title>Angular JS</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha512-dTfge/zgoMYpP7QbHy4gWMEGsbsdZeCXz7irItjcC3sPUFtf0kuFbDz/ixG7ArTxmDjLXDmezHubeNikyKGVyQ==" crossorigin="anonymous">
</head>
<body data-ng-app="calculationApp">
<div data-ng-controller="CalculationController as cal">
<input type="text" name="qty" data-ng-model="cal.qty">
<input type="text" name="cost" data-ng-model="cal.cost">
<select data-ng-model="cal.inCurr">
<option data-ng-repeat="cur in cal.currencies">{{ cur }}</option>
</select>
</div>
<script type="text/javascript" src="angular.min.js"></script>
<!-- Latest compiled and minified JavaScript -->
<script src="//code.jquery.com/jquery-2.2.0.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js" integrity="sha512-K1qjQ+NcF2TYO/eI3M6v8EiNYZfA95pQumfvcVrTHtwQVDG+aHRqLi/ETn2uB+1JqwYqVG3LIvdm9lj6imS/pQ==" crossorigin="anonymous"></script>
<script>
angular.module('calculationApp', ['currencyApp'])
.controller('CalculationController', ['CurrencyController', function(CurrencyController){
this.qty = 4;
this.cost = 5;
this.total = this.qty * this.cost;
this.inCurr = CurrencyController.inCurr;
this.currencies = CurrencyController.currencies;
}]);
angular.module('currencyApp', [])
.factory('CurrencyController', function(){
var inCurr = 'STR';
var currencies = ['GBR', 'STR', 'US'];
return {
currencies : currencies,
inCurr : inCurr
};
});
</script>
</body>
</html>