@angular-wave/angular.ts 0.0.45 → 0.0.47

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,224 @@
1
+ /\*\*
2
+
3
+ - @ngdoc directive
4
+ - @name ngHref
5
+ - @restrict A
6
+ - @priority 99
7
+ -
8
+ - @description
9
+ - Using AngularJS markup like `{{hash}}` in an href attribute will
10
+ - make the link go to the wrong URL if the user clicks it before
11
+ - AngularJS has a chance to replace the `{{hash}}` markup with its
12
+ - value. Until AngularJS replaces the markup the link will be broken
13
+ - and will most likely return a 404 error. The `ngHref` directive
14
+ - solves this problem.
15
+ -
16
+ - The wrong way to write it:
17
+ - ```html
18
+
19
+ ```
20
+
21
+ - <a href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
22
+ - ```
23
+
24
+ ```
25
+
26
+ -
27
+ - The correct way to write it:
28
+ - ```html
29
+
30
+ ```
31
+
32
+ - <a ng-href="http://www.gravatar.com/avatar/{{hash}}">link1</a>
33
+ - ```
34
+
35
+ ```
36
+
37
+ -
38
+ - @element A
39
+ - @param {template} ngHref any string which can contain `{{}}` markup.
40
+ - \*/
41
+
42
+ /\*\*
43
+
44
+ - @ngdoc directive
45
+ - @name ngSrc
46
+ - @restrict A
47
+ - @priority 99
48
+ -
49
+ - @description
50
+ - Using AngularJS markup like `{{hash}}` in a `src` attribute doesn't
51
+ - work right: The browser will fetch from the URL with the literal
52
+ - text `{{hash}}` until AngularJS replaces the expression inside
53
+ - `{{hash}}`. The `ngSrc` directive solves this problem.
54
+ -
55
+ - The buggy way to write it:
56
+ - ```html
57
+
58
+ ```
59
+
60
+ - <img src="http://www.gravatar.com/avatar/{{hash}}" alt="Description"/>
61
+ - ```
62
+
63
+ ```
64
+
65
+ -
66
+ - The correct way to write it:
67
+ - ```html
68
+
69
+ ```
70
+
71
+ - <img ng-src="http://www.gravatar.com/avatar/{{hash}}" alt="Description" />
72
+ - ```
73
+
74
+ ```
75
+
76
+ -
77
+ - @element IMG
78
+ - @param {template} ngSrc any string which can contain `{{}}` markup.
79
+ \*/
80
+
81
+ /\*\*
82
+
83
+ - @ngdoc directive
84
+ - @name ngSrcset
85
+ - @restrict A
86
+ - @priority 99
87
+ -
88
+ - @description
89
+ - Using AngularJS markup like `{{hash}}` in a `srcset` attribute doesn't
90
+ - work right: The browser will fetch from the URL with the literal
91
+ - text `{{hash}}` until AngularJS replaces the expression inside
92
+ - `{{hash}}`. The `ngSrcset` directive solves this problem.
93
+ -
94
+ - The buggy way to write it:
95
+ - ```html
96
+
97
+ ```
98
+
99
+ - <img srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description"/>
100
+ - ```
101
+
102
+ ```
103
+
104
+ -
105
+ - The correct way to write it:
106
+ - ```html
107
+
108
+ ```
109
+
110
+ - <img ng-srcset="http://www.gravatar.com/avatar/{{hash}} 2x" alt="Description" />
111
+ - ```
112
+
113
+ ```
114
+
115
+ -
116
+ - @element IMG
117
+ - @param {template} ngSrcset any string which can contain `{{}}` markup.
118
+ \*/
119
+
120
+ /\*\*
121
+
122
+ - @ngdoc directive
123
+ - @name ngDisabled
124
+ - @restrict A
125
+ - @priority 100
126
+ -
127
+ - @description
128
+ -
129
+ - This directive sets the `disabled` attribute on the element (typically a form control,
130
+ - e.g. `input`, `button`, `select` etc.) if the
131
+ - {@link guide/expression expression} inside `ngDisabled` evaluates to truthy.
132
+ -
133
+ - A special directive is necessary because we cannot use interpolation inside the `disabled`
134
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
135
+ -
136
+ - @param {string} ngDisabled If the {@link guide/expression expression} is truthy,
137
+ - then the `disabled` attribute will be set on the element
138
+ \*/
139
+
140
+ /\*\*
141
+
142
+ - @ngdoc directive
143
+ - @name ngChecked
144
+ - @restrict A
145
+ - @priority 100
146
+ -
147
+ - @description
148
+ - Sets the `checked` attribute on the element, if the expression inside `ngChecked` is truthy.
149
+ -
150
+ - Note that this directive should not be used together with {@link ngModel `ngModel`},
151
+ - as this can lead to unexpected behavior.
152
+ -
153
+ - A special directive is necessary because we cannot use interpolation inside the `checked`
154
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
155
+ -
156
+ - @element INPUT
157
+ - @param {string} ngChecked If the {@link guide/expression expression} is truthy,
158
+ - then the `checked` attribute will be set on the element
159
+ \*/
160
+
161
+ /\*\*
162
+
163
+ -
164
+ - @description
165
+ -
166
+ - Sets the `readonly` attribute on the element, if the expression inside `ngReadonly` is truthy.
167
+ - Note that `readonly` applies only to `input` elements with specific types. [See the input docs on
168
+ - MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#attr-readonly) for more information.
169
+ -
170
+ - A special directive is necessary because we cannot use interpolation inside the `readonly`
171
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
172
+ - @element INPUT
173
+ - @param {string} ngReadonly If the {@link guide/expression expression} is truthy,
174
+ - then special attribute "readonly" will be set on the element
175
+ \*/
176
+
177
+ /\*\*
178
+
179
+ - @ngdoc directive
180
+ - @name ngSelected
181
+ - @restrict A
182
+ - @priority 100
183
+ -
184
+ - @description
185
+ -
186
+ - Sets the `selected` attribute on the element, if the expression inside `ngSelected` is truthy.
187
+ -
188
+ - A special directive is necessary because we cannot use interpolation inside the `selected`
189
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
190
+ -
191
+ - <div class="alert alert-warning">
192
+ - **Note:** `ngSelected` does not interact with the `select` and `ngModel` directives, it only
193
+ - sets the `selected` attribute on the element. If you are using `ngModel` on the select, you
194
+ - should not use `ngSelected` on the options, as `ngModel` will set the select value and
195
+ - selected options.
196
+ - </div>
197
+ - @element OPTION
198
+ - @param {string} ngSelected If the {@link guide/expression expression} is truthy,
199
+ - then special attribute "selected" will be set on the element
200
+ \*/
201
+
202
+ /\*\*
203
+
204
+ - @ngdoc directive
205
+ - @name ngOpen
206
+ - @restrict A
207
+ - @priority 100
208
+ -
209
+ - @description
210
+ -
211
+ - Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
212
+ -
213
+ - A special directive is necessary because we cannot use interpolation inside the `open`
214
+ - attribute. See the {@link guide/interpolation interpolation guide} for more info.
215
+ -
216
+ - ## A note about browser compatibility
217
+ -
218
+ - Internet Explorer and Edge do not support the `details` element, it is
219
+ - recommended to use {@link ng.ngShow} and {@link ng.ngHide} instead.
220
+ -
221
+ - @element DETAILS
222
+ - @param {string} ngOpen If the {@link guide/expression expression} is truthy,
223
+ - then special attribute "open" will be set on the element
224
+ \*/
@@ -1,4 +1,4 @@
1
- import { nodeName_, minErr, directiveNormalize } from "../../shared/utils";
1
+ import { getNodeName, minErr, directiveNormalize } from "../../shared/utils";
2
2
 
3
3
  /**
4
4
  * @ngdoc directive
@@ -36,7 +36,7 @@ export const ngRefDirective = [
36
36
  restrict: "A",
37
37
  compile(tElement, tAttrs) {
38
38
  // Get the expected controller name, converts <data-some-thing> into "someThing"
39
- const controllerName = directiveNormalize(nodeName_(tElement));
39
+ const controllerName = directiveNormalize(getNodeName(tElement));
40
40
 
41
41
  // Get the expression for value binding
42
42
  const getter = $parse(tAttrs.ngRef);
@@ -22,40 +22,6 @@ import { not, val } from "../../shared/hof";
22
22
  import { EventBus } from "../../core/pubsub/pubsub";
23
23
 
24
24
  const err = minErr("$stateProvider");
25
- // Right now this is a collection of all the properties we encounter in tests
26
- const validKeys = [
27
- "$$state",
28
- "__stateObjectCache",
29
- "abstract",
30
- "bindings",
31
- "controller",
32
- "controllerAs",
33
- "controllerProvider",
34
- "component",
35
- "componentProvider",
36
- "data",
37
- "includes",
38
- "lazyLoad",
39
- "name",
40
- "navigable",
41
- "onEnter",
42
- "onExit",
43
- "onRetain",
44
- "params",
45
- "parent",
46
- "path",
47
- "redirectTo",
48
- "reloadOnSearch",
49
- "resolve",
50
- "resolveAs",
51
- "resolvables",
52
- "self",
53
- "template",
54
- "templateProvider",
55
- "templateUrl",
56
- "url",
57
- "views",
58
- ];
59
25
 
60
26
  /**
61
27
  * Provides services related to ui-router states.
@@ -230,13 +196,6 @@ export class StateService {
230
196
  if (!definition.name) {
231
197
  throw err("stateinvalid", `'name' required`);
232
198
  }
233
-
234
- const hasInvalidKeys = Object.keys(definition).filter(
235
- (key) => !validKeys.includes(key),
236
- );
237
- if (hasInvalidKeys.length) {
238
- throw err("stateinvalid", `Invalid key(s): ${hasInvalidKeys.join(", ")}`);
239
- }
240
199
  try {
241
200
  this.stateRegistry.register(definition);
242
201
  } catch (e) {
@@ -128,12 +128,6 @@ describe("$state", () => {
128
128
  }).toThrowError(/stateinvalid/);
129
129
  });
130
130
 
131
- it("should should not allow states that have invalid keys", () => {
132
- expect(() => {
133
- $stateProvider.state({ name: "faulty", faulturl: "/to-string" });
134
- }).toThrowError(/stateinvalid/);
135
- });
136
-
137
131
  it("should requred `name` if state definition object is passed", () => {
138
132
  expect(() => {
139
133
  $stateProvider.state({ url: "/to-string" });
@@ -3,7 +3,7 @@ import {
3
3
  isFunction,
4
4
  isNumber,
5
5
  isString,
6
- nodeName_,
6
+ getNodeName,
7
7
  } from "../shared/utils";
8
8
 
9
9
  export function AnchorScrollProvider() {
@@ -31,7 +31,7 @@ export function AnchorScrollProvider() {
31
31
  function getFirstAnchor(list) {
32
32
  let result = null;
33
33
  Array.prototype.some.call(list, (element) => {
34
- if (nodeName_(element) === "a") {
34
+ if (getNodeName(element) === "a") {
35
35
  result = element;
36
36
  return true;
37
37
  }