我的index.html文件
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="/usr/local/lib/node_modules/angular-i18n/angular-locale_de-de.js"></script>
<body>
<div ng-app="myApp" ng-controller="costCtrl">
<h1>Price: {{ price | currency}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('costCtrl', function($scope) {
$scope.price = 58;
});
</script>
<p>The currency filter formats a number to a currency format.</p>
</body>
</html>不显示欧元符号背后的价值,因为它应该是。我也试图安装角动态地区通过保龄球,但没有任何效果。我坐的是Ubuntu 16.04。LTS机器。
发布于 2018-01-10 14:45:39
下面是一个可以运行的代码片段,您可以尝试使用显示欧元货币符号的德国地区CDN来运行。
<!DOCTYPE html>
<html>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-i18n/1.6.4/angular-locale_de-de.js"></script>
<body>
<div ng-app="myApp" ng-controller="costCtrl">
<h1>Price: {{ price | currency}}</h1>
</div>
<script>
var app = angular.module('myApp', []);
app.controller('costCtrl', function($scope) {
$scope.price = 58;
});
</script>
<p>The currency filter formats a number to a currency format.</p>
</body>
</html>
因为这是可行的,所以我假设您有一个错误路径:/usr/local/lib/node_modules/angular-i18n/angular-locale_de-de.js
发布于 2018-01-10 14:34:41
如果您正在使用npm或bower,请安装角-i18n包。
否则,将其添加到html中。
<script src="i18n/angular-locale_de-de.js"></script>现在,默认货币类型应该是欧元。
https://stackoverflow.com/questions/48189570
复制相似问题