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

Side by Side Diff: third_party/pkg/angular/lib/directive/ng_a.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 * @ngdoc directive
5 * @name ng.directive:a
6 * @restrict E
7 *
8 * @description
9 * Modifies the default behavior of the html A tag so that the default action is prevented when
10 * the href attribute is empty.
11 *
12 * This change permits the easy creation of action links with the `ngClick` dire ctive
13 * without changing the location or causing page reloads, e.g.:
14 * `<a href="" ng-click="model.$save()">Save</a>`
15 */
16 @NgDirective(selector: 'a[href]')
17 class NgADirective {
18 dom.Element element;
19
20 NgADirective(dom.Element element) {
21 if (element.attributes["href"] == "") {
22 element.onClick.listen((event) {
23 if (element.attributes["href"] == "") {
24 event.preventDefault();
25 }
26 });
27 }
28 }
29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698