Skip to content

Commit 71d2d07

Browse files
committed
feat(NgPluralize)
1 parent 81618ec commit 71d2d07

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

lib/directive/ng_pluralize.dart

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class NgPluralizeDirective {
101101
Watch _watch;
102102

103103
static final RegExp IS_WHEN = new RegExp(r'^when-(minus-)?.');
104+
104105
static const Map<String, Symbol> SYMBOLS = const {
105106
'zero' : #zero,
106107
'one' : #one,
@@ -111,11 +112,12 @@ class NgPluralizeDirective {
111112
};
112113

113114
NgPluralizeDirective(this._scope, this._element, this._interpolate,
114-
this._filters, NodeAttrs attributes) {
115-
final whens = attributes['when'] == null
115+
this._filters) {
116+
var attrs = _element.attributes;
117+
final whens = attrs['when'] == null
116118
? <String, String>{}
117-
: _scope.eval(attributes['when']);
118-
_offset = attributes['offset'] == null ? 0 : int.parse(attributes['offset']);
119+
: _scope.eval(attrs['when']);
120+
_offset = attrs['offset'] == null ? 0 : int.parse(attrs['offset']);
119121

120122
_element.attributes.keys.where((k) => IS_WHEN.hasMatch(k)).forEach((k) {
121123
var ruleName = k
@@ -164,7 +166,6 @@ class NgPluralizeDirective {
164166
}
165167
}
166168

167-
168169
void _setAndWatch(template) {
169170
if (_watch != null) _watch.remove();
170171
var expression = _expressionCache.putIfAbsent(template, () =>
@@ -175,4 +176,4 @@ class NgPluralizeDirective {
175176
void _updateMarkup(text, previousText) {
176177
if (text != previousText) _element.text = text;
177178
}
178-
}
179+
}

0 commit comments

Comments
 (0)