Commit Graph

1722 Commits

Author SHA1 Message Date
Caitlin Potter
ff791c9330 test($http): test that timed out $http request rejects promise
Closes #7688
Closes #7686
2014-06-05 20:12:26 -04:00
rodyhaddad
c97c5cec2f test(jqLite): adapt missed test to new expando name 2014-06-05 14:45:26 -07:00
rodyhaddad
ee8fae8c0f test(jqLite): adapt tests to new expando name 2014-06-05 14:14:48 -07:00
rodyhaddad
d3c50c8456 feat($resource): allow props beginning with $ to be used on resources
BREAKING CHANGE:

If you expected `$resource` to strip these types of properties before,
you will have to manually do this yourself now.
2014-06-03 17:16:18 -07:00
rodyhaddad
c054288c97 fix(angular.toJson): only strip properties beginning with $$, not $
BREAKING CHANGE:

If you expected `toJson` to strip these types of properties before,
you will have to manually do this yourself now.
2014-06-03 17:15:58 -07:00
Isaac Shapira
222d47370e fix(ngAnimate): $animate methods should accept native dom elements 2014-06-02 13:40:12 -07:00
cexbrayat
24c844df3b fix($parse): fix parsing error with leading space and one time bind
Closes #7640
2014-06-02 13:23:21 -07:00
Phil Westwell
0dc35efd7c docs(*): fix its/it's grammar
Closes #7580
2014-05-31 18:43:26 -04:00
Caitlin Potter
a594fa523f style(ngClassSpec): fix indentation to make jscs happy 2014-05-30 15:13:05 -04:00
Shahar Talmi
7eaaca8ef2 fix(ngClass): support multiple classes in key 2014-05-30 11:53:50 -07:00
rodyhaddad
083f496d46 fix(angular.copy): support circular references in the value being copied
Closes #7618
2014-05-30 11:45:57 -07:00
rodyhaddad
a87135bb43 chore(shallowCopy): handle arrays and primitives, and switch to using it where possible
In many cases, we want a shallow copy instead of a full copy

Closes #7618
2014-05-30 11:45:47 -07:00
Andrew Kulinich
9f5c437048 fix(ngAnimate): fix property name that is used to calculate cache key
Fix property name that introduced a bug that occurs when there are 2 animations per page
with similar signature. Due to mistype they were assigned same cache key so second
animation was processed incorrectly

Closes #7566
2014-05-30 01:04:07 -04:00
Vojta Jina
440be33d48 test($compile): transcludeFn is available in compile of templateUrl directive 2014-05-29 12:54:44 -07:00
Vojta Jina
56c60218d1 fix($compile): bound transclusion to correct scope
Nested isolated transclude directives.

This improves/fixes the fix in d414b78717.

See the changed ng-ifunit test: The template inside ng-if should be bound to the
isolate scope of `iso` directive (resp. its child scope). Not to a child of
the root scope. This shows the issue with ng-if. It’s however problem with
other directives too.

Instead of remembering the scope, we pass around the bound parent transclusion.
2014-05-29 12:54:03 -07:00
Vojta Jina
0c8a2cd2da fix($compile): set the iteration state before linking
This issue was introduced in b87e5fc092.
The state for each row has to be set up *before* linking.

The cloneFn (the function passed into $transclude) is called *before* actual linking and thus it is enough to update the state inside the cloneFn callback.
2014-05-29 12:53:06 -07:00
Peter Bacon Darwin
2ee29c5da8 fix($compile): don't pass transcludes to non-transclude templateUrl directives 2014-05-29 12:52:12 -07:00
Peter Bacon Darwin
b87e5fc092 fix(ngRepeat): ensure that the correct (transcluded) scope is used 2014-05-29 12:52:12 -07:00
Peter Bacon Darwin
d71df9f83c fix(ngIf): ensure that the correct (transcluded) scope is used 2014-05-29 12:52:12 -07:00
Peter Bacon Darwin
19af039745 fix($compile): don't pass transclude to template of non-transclude directive
If a directive provides a template but is not explicitly requesting transclusion
then the compiler should not pass a transclusion function to the directives
within the template.
2014-05-29 12:52:12 -07:00
Peter Bacon Darwin
d414b78717 fix($compile): fix nested isolated transclude directives
Closes #1809
Closes #7499
2014-05-29 12:52:11 -07:00
Peter Bacon Darwin
1fef5fe823 fix($compile): pass transcludeFn down to nested transclude directives
If you have two directives that both expect to receive transcluded content
the outer directive works but the inner directive never receives a
transclusion function. This only failed if the first transclude directive
was not the first directive found in compilation.

Handles the regression identified in e994259739

Fixes #7240
Closes #7387
2014-05-29 12:52:11 -07:00
Peter Bacon Darwin
bea77e4b15 style($compileSpec): fix typos 2014-05-29 12:52:11 -07:00
Igor Minar
3ec4af9413 chore(parseSpec): fix bad merge 2014-05-23 15:08:36 -07:00
Matias Niemelä
98b9d68ea3 fix($animate): retain inline styles for property-specific transitions
Transitions that are run through ngAnimate which contain a specific property
cause any inline styles to be erased after the animation is done. This has
something to do with how the browsers handle transitions that do not use
"all" as a transition property.

Closes #7503
2014-05-23 14:45:20 -07:00
Lucas Galfaso
cee429f0aa feat(*): lazy one-time binding support
Expressions that start with `::` will be binded once. The rule
that binding follows is that the binding will take the first
not-undefined value at the end of a $digest cycle.

Watchers from $watch, $watchCollection and $watchGroup will
automatically stop watching when the expression(s) are bind-once
and fulfill.

Watchers from text and attributes interpolations will
automatically stop watching when the expressions are fulfill.

All directives that use $parse for expressions will automatically
work with bind-once expressions. E.g.

<div ng-bind="::foo"></div>
<li ng-repeat="item in ::items">{{::item.name}};</li>

Paired with: Caitlin and Igor
Design doc: https://docs.google.com/document/d/1fTqaaQYD2QE1rz-OywvRKFSpZirbWUPsnfaZaMq8fWI/edit#
Closes #7486
Closes #5408
2014-05-23 14:40:51 -07:00
Julie
701ed5fdf6 tests(docsAppE2E): fix race condition flake with switching to new frame
Closes #7569
2014-05-23 11:28:53 -07:00
rodyhaddad
fa6e411da2 fix($parse): remove deprecated promise unwrapping
The feature has been deprecated in #4317

BREAKING CHANGE: promise unwrapping has been removed.
It has been deprecated since 1.2.0-rc.3.

It can no longer be turned on.
Two methods have been removed:
* $parseProvider.unwrapPromises
* $parseProvider.logPromiseWarnings
2014-05-22 22:50:34 -07:00
Jeff Whelpley
1ab6e908b1 fix($compile): do not merge attrs that are the same for replace directives
If a directives specifies `replace:true` and the template of the directive contains
a root element with an attribute which already exists at the place
where the directive is used with the same value, don't duplicate the value.

Closes #7463
2014-05-21 15:51:19 -07:00
Richard Littauer
ff16d224ca test(ngClass): add missing assertions 2014-05-21 13:23:30 -07:00
Sam Dornan
6cb35adfe8 chore(rootScope): fix grammar in a test description
it's -> its

☆.。.:*・゜☆ Yeah, why not ☆.。.:*・゜☆

Closes #7534
2014-05-21 10:41:47 -04:00
Igor Minar
82f45aee5b fix(Scope): $broadcast and $emit should set event.currentScope to null
When a event is finished propagating through Scope hierarchy the event's `currentScope` property
should be reset to `null` to avoid accidental use of this property in asynchronous event handlers.

In the previous code, the event's property would contain a reference to the last Scope instance that
was visited during the traversal, which is unlikely what the code trying to grab scope reference expects.

BREAKING CHANGE: $broadcast and $emit will now reset the `currentScope` property of the event to
null once the event finished propagating. If any code depends on asynchronously accessing thei
`currentScope` property, it should be migrated to use `targetScope` instead. All of these cases
should be considered programming bugs.

Closes #7445
Closes #7523
2014-05-21 00:20:20 -07:00
Ralph Giles
def5b57de8 docs(*): fix its vs it's typos.
Only use the apostrophe if you can expand "it's" to "it is" and
still have a grammatical phrase.

Closes #7524
2014-05-20 17:45:08 -04:00
Caitlin Potter
e3f78c17d3 feat($interpolate): escaped interpolation expressions
This CL enables interpolation expressions to be escaped, by prefixing each character of their
start/end markers with a REVERSE SOLIDUS U+005C, and to render the escaped expression as a
regular interpolation expression.

Example:

`<span ng-init="foo='Hello'">{{foo}}, \\{\\{World!\\}\\}</span>` would be rendered as:
`<span ng-init="foo='Hello'">Hello, {{World!}}</span>`

This will also work with custom interpolation markers, for example:

     module.
       config(function($interpolateProvider) {
         $interpolateProvider.startSymbol('\\\\');
         $interpolateProvider.endSymbol('//');
       }).
       run(function($interpolate) {
         // Will alert with "hello\\bar//":
         alert($interpolate('\\\\foo//\\\\\\\\bar\\/\\/')({foo: "hello", bar: "world"}));
       });

This change effectively only changes the rendering of these escaped markers, because they are
not context-aware, and are incapable of preventing nested expressions within those escaped
markers from being evaluated.

Therefore, backends are encouraged to ensure that when escaping expressions for security
reasons, every single instance of a start or end marker have each of its characters prefixed
with a backslash (REVERSE SOLIDUS, U+005C)

Closes #5601
Closes #7517
2014-05-20 15:41:20 -04:00
Igor Minar
e994259739 revert: fix($compile): pass transcludeFn down to nested transclude directives
This reverts commit 113850602d.

This change introduced regressions for several scenarios.

reduction: http://jsfiddle.net/5242N/4/
2014-05-20 11:00:26 -07:00
Shahar Talmi
facd904a61 fix(ngModel): do not dirty the input on $commitViewValue if nothing was changed
Calling `$commitViewValue` was was dirtying the input, even if no update to the view
value was made.
For example, `updateOn` triggers and form submit may call `$commitViewValue` even
if the the view value had not changed.

Closes #7457
Closes #7495
2014-05-18 08:35:21 +01:00
Brian Ford
96fa70511d test($compile): use trim helper 2014-05-16 18:18:26 -07:00
Shahar Talmi
5fbd618c2f fix(ngClass): handle index changes when an item is unshifted
Closes #7256
2014-05-16 14:02:41 -07:00
Vojta Jina
4f03dc5a96 fix($compile): pass transcludeFn down to nested transclude directives
If you have two directives that both expect to receive transcluded content
the outer directive works but the inner directive never receives a
transclusion function. This only failed if the first transclude directive
was not the first directive found in compilation.

Fixes #7240
Closes #7387
2014-05-16 13:08:10 -07:00
Lucas Galfaso
81d427b5f0 fix(numberFilter): fix rounding error edge case
Fix a number rounding error.

Closes #7453
Closes #7478
2014-05-15 21:18:59 +01:00
Caitlin Potter
7a3cbb3c79 test(ngMessages): use strict-di for ngMessages tests
This will hopefully prevent issues similar to the one fixed by 63b100c0

Closes #7477
2014-05-15 11:14:15 -04:00
Robin Böhm
5a568b4f96 feat(ngTouch): add optional ngSwipeDisableMouse attribute to ngSwipe directives to ignore mouse events.
This attribute is useful for text that should still be selectable
by the mouse and not trigger the swipe action.

This also adds an optional third argument to `$swipe.bind` to define
the pointer types that should be listened to.

Closes #6627
Fixes #6626
2014-05-14 14:17:19 -07:00
Michał Gołębiowski
d71dbb1ae5 refactor(jqLite): stop patching individual jQuery methods
Currently Angular monkey-patches a few jQuery methods that remove elements
from the DOM. Since methods like .remove() have multiple signatures
that can change what's actually removed, Angular needs to carefully
repeat them in its patching or it can break apps using jQuery correctly.
Such a strategy is also not future-safe.

Instead of patching individual methods on the prototype, it's better to
hook into jQuery.cleanData and trigger custom events there. This should be
safe as e.g. jQuery UI needs it and uses it. It'll also be future-safe.

The only drawback is that $destroy is no longer triggered when using $detach
but:

  1. Angular doesn't use this method, jqLite doesn't implement it.
  2. Detached elements can be re-attached keeping all their events & data
     so it makes sense that $destroy is not triggered on them.
  3. The approach from this commit is so much safer that any issues with
     .detach() working differently are outweighed by the robustness of the code.

BREAKING CHANGE: the $destroy event is no longer triggered when using the
jQuery detach() method. If you want to destroy Angular data attached to the
element, use remove().
2014-05-10 23:32:29 +02:00
Shahar Talmi
562c4e424b fix($compile): set $isolateScope correctly for sync template directives
All isolated scope directives that do not have `templateUrl` were marked
as `$isolateScopeNoTemplate` even if they did have a `template` attribute.

This caused `jqLite#scope()` to return the wrong value for child elements
within the directive's template.

Closes #6942
2014-05-09 14:42:26 +01:00
Shahar Talmi
a0ae07bd4e feat(FormController): commit $viewValue of all child controls when form is submitted
Use the new `NgModelController.$commitViewValue()` method to commit the
`$viewValue` on all the child controls (including nested `ngForm`s) when the form
receives the `submit` event. This will happen immediately, overriding any
`updateOn` and `debounce` settings from `ngModelOptions`.

If you wish to access the committed `$modelValue`s then you can use the `ngSubmit`
directive to provide a handler.  Don't use `ngClick` on the submit button, as this
handler would be called before the pending `$viewValue`s have been committed.

Closes #7017
2014-05-09 11:50:00 +01:00
Shahar Talmi
adfc322b04 refactor(ngModelOptions): move debounce and updateOn logic into NgModelController
Move responsibility for pending and debouncing model updates into `NgModelController`.
Now input directives are only responsible for capturing changes to the input element's
value and then calling `$setViewValue` with the new value.

Calls to `$setViewValue(value)` change the `$viewValue` property but these changes are
not committed to the `$modelValue` until an `updateOn` trigger occurs (and any related
`debounce` has resolved).

The `$$lastCommittedViewValue` is now stored when `$setViewValue(value)` updates
the `$viewValue`, which allows the view to be "reset" by calling `$rollbackViewValue()`.

The new `$commitViewValue()` method allows developers to force the `$viewValue` to be
committed through to the `$modelValue` immediately, ignoring `updateOn` triggers and
`debounce` delays.

BREAKING CHANGE:

This commit changes the API on `NgModelController`, both semantically and
in terms of adding and renaming methods.

* `$setViewValue(value)` -
This method still changes the `$viewValue` but does not immediately commit this
change through to the `$modelValue` as it did previously.
Now the value is committed only when a trigger specified in an associated
`ngModelOptions` directive occurs. If `ngModelOptions` also has a `debounce` delay
specified for the trigger then the change will also be debounced before being
committed.
In most cases this should not have a significant impact on how `NgModelController`
is used: If `updateOn` includes `default` then `$setViewValue` will trigger
a (potentially debounced) commit immediately.
* `$cancelUpdate()` - is renamed to `$rollbackViewValue()` and has the same meaning,
which is to revert the current `$viewValue` back to the `$lastCommittedViewValue`,
to cancel any pending debounced updates and to re-render the input.

To migrate code that used `$cancelUpdate()` follow the example below:

Before:

```
  $scope.resetWithCancel = function (e) {
    if (e.keyCode == 27) {
      $scope.myForm.myInput1.$cancelUpdate();
      $scope.myValue = '';
    }
  };
```

After:

```
  $scope.resetWithCancel = function (e) {
    if (e.keyCode == 27) {
      $scope.myForm.myInput1.$rollbackViewValue();
      $scope.myValue = '';
    }
  }
```
2014-05-09 11:41:38 +01:00
Shahar Talmi
0ef17276e9 refactor(inputSpec): move call to $digest into compileInput helper
It is reasonable to expect a digest to occur between an input element
compiling and the first user interaction.  Rather than add digests to
each test this change moves it into the `compileInput` helper function.
2014-05-09 09:56:27 +01:00
Caitlin Potter
ac37915ef6 fix(ngSwitch): properly support case labels with different numbers of transclude fns
Due to a regression introduced several releases ago, the ability for multiple transclude functions
to work correctly changed, as they would break if different case labels had different numbers of
transclude functions.

This CL corrects this by not assuming that previous elements and scope count have the same length.

Fixes #7372
Closes #7373
2014-05-08 17:08:04 -04:00
Joel Hooks
c56e32a7fa fix(ngModelOptions): enable overriding the default with a debounce of zero
Because of how the logic was set up, a value of `0` was assumed to be the
same as `undefined`, which meant that you couldn't override the default
debounce delay with a value of zero.

For example, the following assigned a debounce delay of 500ms to the `blur`
event.

```
ngModelOptions="{ updateOn: 'default blur', debounce: {'default': 500, 'blur':
0} }"
```

Closes #7205
2014-05-04 20:18:27 +01:00
Shahar Talmi
fbf5ab8f17 fix(ngModelOptions): initialize ngModelOptions in prelink
Input controls require `ngModel` which in turn brings in the `ngModelOptions`
but since ngModel does this initialization in the post link function, the
order in which the directives are run is relevant.

Directives are sorted by priority and name but `ngModel`, `input` and `textarea`
have the same priority. It just happens that `textarea` is alphabetically
sorted and so linked before `ngModel` (unlike `input`).

This is a problem since inputs expect `ngModelController.$options`
to exist at post-link time and for `textarea` this has not happened.

This is solved easily by moving the initialization of `ngModel` to the
pre-link function.

Closes #7281
Closes #7292
2014-05-04 20:07:07 +01:00