Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(138)

Side by Side Diff: third_party/pkg/angular/lib/core_dom/mustache.dart

Issue 257423008: Update all Angular libs (run update_all.sh). (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 part of angular.core.dom_internal;
2
3 // This Directive is special and does not go through injection.
4 @Decorator(selector: r':contains(/{{.*}}/)')
5 class TextMustache {
6 final dom.Node _element;
7
8 TextMustache(this._element,
9 String template,
10 Interpolate interpolate,
11 Scope scope,
12 FormatterMap formatters) {
13 String expression = interpolate(template);
14
15 scope.watch(expression,
16 _updateMarkup,
17 canChangeModel: false,
18 formatters: formatters);
19 }
20
21 void _updateMarkup(text, previousText) {
22 _element.text = text;
23 }
24 }
25
26 // This Directive is special and does not go through injection.
27 @Decorator(selector: r'[*=/{{.*}}/]')
28 class AttrMustache {
29 bool _hasObservers;
30 Watch _watch;
31 NodeAttrs _attrs;
32 String _attrName;
33
34 // This Directive is special and does not go through injection.
35 AttrMustache(this._attrs,
36 String template,
37 Interpolate interpolate,
38 Scope scope,
39 FormatterMap formatters) {
40 var eqPos = template.indexOf('=');
41 _attrName = template.substring(0, eqPos);
42 String expression = interpolate(template.substring(eqPos + 1));
43
44 _updateMarkup('', template);
45
46 _attrs.listenObserverChanges(_attrName, (hasObservers) {
47 if (_hasObservers != hasObservers) {
48 _hasObservers = hasObservers;
49 if (_watch != null) _watch.remove();
50 _watch = scope.watch(expression, _updateMarkup, formatters: formatters,
51 canChangeModel: _hasObservers);
52 }
53 });
54 }
55
56 void _updateMarkup(text, previousText) {
57 if (text != previousText && !(previousText == null && text == '')) {
58 _attrs[_attrName] = text;
59 }
60 }
61 }
62
OLDNEW
« no previous file with comments | « third_party/pkg/angular/lib/core_dom/module_internal.dart ('k') | third_party/pkg/angular/lib/core_dom/ng_element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698