| Index: third_party/pkg/angular/lib/directive/ng_a.dart
|
| diff --git a/third_party/pkg/angular/lib/directive/ng_a.dart b/third_party/pkg/angular/lib/directive/ng_a.dart
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..59d99c09565a30b08c3ec97f4e319049ebbf0da2
|
| --- /dev/null
|
| +++ b/third_party/pkg/angular/lib/directive/ng_a.dart
|
| @@ -0,0 +1,29 @@
|
| +part of angular.directive;
|
| +
|
| +/**
|
| + * @ngdoc directive
|
| + * @name ng.directive:a
|
| + * @restrict E
|
| + *
|
| + * @description
|
| + * Modifies the default behavior of the html A tag so that the default action is prevented when
|
| + * the href attribute is empty.
|
| + *
|
| + * This change permits the easy creation of action links with the `ngClick` directive
|
| + * without changing the location or causing page reloads, e.g.:
|
| + * `<a href="" ng-click="model.$save()">Save</a>`
|
| + */
|
| +@NgDirective(selector: 'a[href]')
|
| +class NgADirective {
|
| + dom.Element element;
|
| +
|
| + NgADirective(dom.Element element) {
|
| + if (element.attributes["href"] == "") {
|
| + element.onClick.listen((event) {
|
| + if (element.attributes["href"] == "") {
|
| + event.preventDefault();
|
| + }
|
| + });
|
| + }
|
| + }
|
| +}
|
|
|