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

Side by Side Diff: third_party/pkg/angular/lib/directive/ng_template.dart

Issue 124053002: Adding Angular and dependent packages for testing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 11 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.directive;
2
3 /**
4 * The [NgTemplateElementDirective] allows one to preload an Angular template
5 * into the [TemplateCache]. It works on `<template>` and `<script>` elements
6 * that have `type="text/ng-template`. For such elements, The entire contents
7 * of the elements are loaded into the [TemplateCache] under the URL specified
8 * by the `id` attribute.
9 *
10 * Sample usage:
11 *
12 * <template id="template_1.html" type="text/ng-template">
13 * TEMPLATE 1 CONTENTS
14 * </template>
15 * <script id="template_2.html" type="text/ng-template">
16 * TEMPLATE 2 CONTENTS
17 * </template>
18 *
19 * Refer [TemplateCache] for a **full example** as well as more information.
20 */
21 @NgDirective(
22 selector: 'template[type=text/ng-template]',
23 map: const {'id': '@templateUrl'})
24 @NgDirective(
25 selector: 'script[type=text/ng-template]',
26 children: NgAnnotation.IGNORE_CHILDREN,
27 map: const {'id': '@templateUrl'})
28 class NgTemplateDirective {
29 dom.Element element;
30 TemplateCache templateCache;
31
32 NgTemplateDirective(this.element, this.templateCache);
33 set templateUrl(url) => templateCache.put(url, new HttpResponse(200,
34 (element is dom.TemplateElement
35 ? (element as dom.TemplateElement).content.innerHtml
36 : element.innerHtml)));
37 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698