我正在使用 ng-plurazlize 的简单示例。我不明白为什么它没有打印值。你能解释一下为什么它不起作用吗?
这是笨蛋 http://plnkr.co/edit/JnOAa2B0hHSL22hIL2MY?p=preview
<input type="text" ng-model='plCount'/>
<h1><ng-plurazlize count="plCount" offset=when="{'0':'one','other':'{}are'}"></ng-plurazlize>
</h1>
最佳答案
那里有一个错字,加上你的 when 参数是错误的。应该是这样的:
<ng-pluralize count="plCount" when="{'0':'one','other':'{}are'}">
</ng-pluralize>
您的偏移量参数不正确。这应该是一个数字。例如:
<ng-pluralize count="plCount" offset=2 when="{'0':'one','other':'{}are'}">
</ng-pluralize>
我在这里工作:http://plnkr.co/edit/eqxOlDnw6cHCbqlWBmk3?p=preview
这是 HTML:
<div ng-app="app">
<div ng-controller="TestCtrl">
<input type="text" ng-model='plCount' />
<h1>
<ng-pluralize count="plCount" offset=2 when="{'0':'one','other':'{}are'}">
</ng-pluralize>
</h1>
</div>
</div>
JavaScript 也不见了。我添加了它:
var app = angular.module('app', []);
app.controller('TestCtrl', function ($scope) {
$scope.plCount = '0';
})
关于javascript - 为什么 ng-plurazlize 不能在 Angular js 中工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25744317/