作者热门文章
- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 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/
我正在使用 ng-plurazlize 的简单示例。我不明白为什么它没有打印值。你能解释一下为什么它不起作用吗? 这是笨蛋 http://plnkr.co/edit/JnOAa2B0hHSL22hIL
我是一名优秀的程序员,十分优秀!