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

Unified Diff: third_party/pkg/angular/lib/core/filter.dart

Issue 256553002: Revert "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 side-by-side diff with in-line comments
Download patch
Index: third_party/pkg/angular/lib/core/filter.dart
diff --git a/third_party/pkg/angular/lib/core/filter.dart b/third_party/pkg/angular/lib/core/filter.dart
new file mode 100644
index 0000000000000000000000000000000000000000..6b8740754aae442287027965d76ccda2c31f741a
--- /dev/null
+++ b/third_party/pkg/angular/lib/core/filter.dart
@@ -0,0 +1,53 @@
+part of angular.core;
+
+/**
+ * Use @[NgFilter] annotation to register a new filter. A filter is a class
+ * with a [call] method (a callable function).
+ *
+ * Usage:
+ *
+ * // Declaration
+ * @NgFilter(name:'myFilter')
+ * class MyFilter {
+ * call(valueToFilter, optArg1, optArg2) {
+ * return ...;
+ * }
+ * }
+ *
+ *
+ * // Registration
+ * var module = ...;
+ * module.type(MyFilter);
+ *
+ *
+ * <!-- Usage -->
+ * <span>{{something | myFilter:arg1:arg2}}</span>
+ */
+class NgFilter {
+ final String name;
+
+ const NgFilter({this.name});
+
+ int get hashCode => name.hashCode;
+ bool operator==(other) => this.name == other.name;
+
+ toString() => 'NgFilter: $name';
+}
+
+/**
+ * Registry of filters at runtime.
+ */
+@NgInjectableService()
+class FilterMap extends AnnotationMap<NgFilter> {
+ Injector _injector;
+ FilterMap(Injector injector, MetadataExtractor extractMetadata) :
+ this._injector = injector,
+ super(injector, extractMetadata);
+
+ call(String name) {
+ var filter = new NgFilter(name:name);
+ var filterType = this[filter];
+ return _injector.get(filterType);
+ }
+}
+
« no previous file with comments | « third_party/pkg/angular/lib/core/exception_handler.dart ('k') | third_party/pkg/angular/lib/core/formatter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698