Commit Graph

2781 Commits

Author SHA1 Message Date
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
Joe Pettersson
28af74a901 docs(dateFilter): correct example for date 'fullDate filter'
The equivalent expanded example for 'fullDate' is given as 'EEEE, MMMM d,y'
whereas it should be 'EEEE, MMMM d, y'. With added whitespace.

Closes #7350
2014-05-08 10:53:34 +02:00
Taylor Hutchison
88335fdfcf docs(ngCookies): correct arguments in $cookieStore example
Closes #7390
2014-05-08 10:29:28 +02:00
mjfroehlich
72d63dbcc0 docs(Scope): fix typo in a link
Closes #7389
2014-05-08 10:23:03 +02:00
Matias Niemelä
2faa4781c5 docs(NgMessages): fix up links and headings 2014-05-07 00:52:25 -04:00
barcahead
6f9bcd3307 docs($rootScope): use unshift to add items to the array at the beginning
Closes #7364
2014-05-06 21:29:30 -04:00
spacemigas
1c0241e5b2 docs($interpolate): fix bug in example
Closes #7342
2014-05-04 20:37:34 +01: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
Peter Bacon Darwin
8c08fcfb1b test(ngModelOptions): fix e2e test focussing 2014-05-04 20:07:07 +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
raghudodda
e395170eef docs(ngModelOptions): correct typo
Closes #7335
2014-05-04 18:59:12 +01:00
Yutaka Yamaguchi
627b0354ec fix(ngSanitize): encode surrogate pair properly
The encodeEndities function encode non-alphanumeric characters to entities with charCodeAt.
charCodeAt does not return one value when their unicode codeponts is higher than 65,356.
It returns surrogate pair, and this is why the Emoji which has higher codepoints is garbled.
We need to handle them properly.

Closes #5088
Closes #6911
2014-05-02 17:48:57 -04:00
Brian Ford
8d18038301 fix(ngSrc, ngSrcset): only interpolate if all expressions are defined
BREAKING CHANGE

If `bar` is `undefined`, before `<img src="foo/{{bar}}.jpg">` yields
`<img src="foo/.jpg">`. With this change, the binding will not set `src`.

If you want the old behavior, you can do this: `<img src="foo/{{bar || ''}}.jpg">`.

The same applies for `srcset` as well.

Closes #6984
2014-05-02 14:06:57 -07:00
Brian Ford
c2362e3f45 feat($interpolate): add optional allOrNothing param 2014-05-02 14:06:57 -07:00
Peter Bacon Darwin
2b6c2c5fbd docs(Attributes): ensure code sample is not escaped
Closes #6649
2014-05-02 21:49:15 +01:00
Matias Niemelä
0f4016c84a feat(NgMessages): introduce the NgMessages module and directives
The ngMessages module provides directives designed to better support
handling and reusing error messages within forms without the need to
rely on complex structural directives.

Please note that the API for ngMessages is experimental and may possibly change with
future releases.
2014-05-02 16:31:34 -04:00
Caitlin Potter
c0b4e2db9c fix(injector): invoke config blocks for module after all providers
This change ensures that a module's config blocks are always invoked after all of its providers are
registered.

BREAKING CHANGE:

Previously, config blocks would be able to control behaviour of provider registration, due to being
invoked prior to provider registration. Now, provider registration always occurs prior to configuration
for a given module, and therefore config blocks are not able to have any control over a providers
registration.

Example:

Previously, the following:

   angular.module('foo', [])
     .provider('$rootProvider', function() {
       this.$get = function() { ... }
     })
     .config(function($rootProvider) {
       $rootProvider.dependentMode = "B";
     })
     .provider('$dependentProvider', function($rootProvider) {
       if ($rootProvider.dependentMode === "A") {
         this.$get = function() {
           // Special mode!
         }
       } else {
         this.$get = function() {
           // something else
         }
       }
     });

would have "worked", meaning behaviour of the config block between the registration of "$rootProvider"
and "$dependentProvider" would have actually accomplished something and changed the behaviour of the
app. This is no longer possible within a single module.

Fixes #7139
Closes #7147
2014-05-02 14:12:22 -04:00
Caitlin Potter
924ee6db06 fix($interpolate): don't ReferenceError when context is undefined
546cb42 introduced a regression, which would cause the function returned from
$interpolate to throw a ReferenceError if `context` is undefined. This change
prevents the error from being thrown.

Closes #7230
Closes #7237
2014-05-02 13:58:13 -04:00
Chris Rose
69d96e8b71 docs($injector): fix typos 2014-05-01 15:35:58 -07:00
Dave Smith
e1d6178457 fix($httpBackend): Add missing expectHEAD() method
This was documented but not implemented.

With accompanying unit test to ensure the $httpBackend.expect*() methods exist.

Closes #7320
2014-04-30 18:51:20 -04:00
Janas Page
3fb2d2ac3b docs($anchorScroll): minor copyedit.
Singular-tense verb. Definite article.

Closes #7319
2014-04-30 17:49:28 -04:00
Caitlin Potter
ad4336f935 chore($http): remove deprecated responseInterceptors functionality
Code cleanup! response interceptors have been deprecated for some time, and it is confusing to have
two APIs, one of which is slightly "hidden" and hard to see, which perform the same task. The newer
API is a bit cleaner and more visible, so this is naturally preferred.

BREAKING CHANGE:

Previously, it was possible to register a response interceptor like so:

    // register the interceptor as a service
    $provide.factory('myHttpInterceptor', function($q, dependency1, dependency2) {
      return function(promise) {
        return promise.then(function(response) {
          // do something on success
          return response;
        }, function(response) {
          // do something on error
          if (canRecover(response)) {
            return responseOrNewPromise
          }
          return $q.reject(response);
        });
      }
    });

    $httpProvider.responseInterceptors.push('myHttpInterceptor');

Now, one must use the newer API introduced in v1.1.4 (4ae46814), like so:

    $provide.factory('myHttpInterceptor', function($q) {
      return {
        response: function(response) {
          // do something on success
          return response;
        },
        responseError: function(response) {
          // do something on error
          if (canRecover(response)) {
            return responseOrNewPromise
          }
          return $q.reject(response);
        }
      };
    });

    $httpProvider.interceptors.push('myHttpInterceptor');

More details on the new interceptors API (which has been around as of v1.1.4) can be found at
https://docs.angularjs.org/api/ng/service/$http#interceptors

Closes #7266
Closes #7267
2014-04-30 17:00:52 -04:00
Peter Bacon Darwin
8b8992b145 revert: test(ngModelOptions): ensure input has focus in e2e tests
This reverts commit 8d38ec3892.
The protractor tests for ng-model-options were failing locally on Chrome
for me but this commit breaks the tests on Firefox.
2014-04-30 11:01:02 +01:00
Caitlin Potter
f0e12ea7fe feat($compile): allow SVG and MathML templates via special type property
Previously, templates would always be assumed to be valid HTML nodes. In some cases, it is
desirable to use SVG or MathML or some other language.

For the time being, this change is only truly meaningful for SVG elements, as MathML has
very limited browser support. But in the future, who knows?

Closes #7265
2014-04-29 14:48:50 -04:00
Peter Bacon Darwin
8d38ec3892 test(ngModelOptions): ensure input has focus in e2e tests
This was not failing on Travis or Jenkins but was reliably failing on my
local build.
2014-04-29 13:29:01 +01:00
Brian Ford
7570e9f07d docs($sce): fix grammar 2014-04-28 23:53:37 -07:00
Edward Brey
e3814b1266 docs(angular.Module): add link to module.config() docs
Add a link on where to find more info about how to use `module.config()`

Closes #6270
2014-04-28 15:05:40 +01:00
Ryan Hall
0d691a6feb docs(orderBy): clarify how sorting is processed
An API was passing me numbers as strings (ex. '8.25'), and I was noticing
weird sorting behavior with `orderBy` because it was trying to sort the
numbers alphabetically.

Closes #5436
2014-04-28 14:53:34 +01:00
marcin-wosinek
e37e67eadb docs(select): improve naming of c variable in example
It was felt that `c` did not make it clear what the variable held. This
has been changed to `color` to match the ng-repeat expression above.
In turn the model value has been changed to `myColor` to prevent a name
collision.

Closes #7210
2014-04-28 13:54:03 +01:00
eydreeyawn
7a543c985e docs(ngCookies): added example usage of cookieStore
Closes #7278
2014-04-28 08:18:51 -04:00
Caitlin Potter
7d1719e219 docs(ngCookies): use GFM code-snippet rather than example tag
The example tag creates a big ugly white rectangle on the docs page, and this is not very helpful
and kind of looks bad. So GFM snippets are a better way to go.

This fix also removes the unnecessary example heading from the $cookieStore page, as there has not
been an example use of $cookieStore for 2 years now.

Closes #7279
2014-04-28 07:55:47 -04:00
Igor Minar
498835a1c4 fix($location): don't clobber path during parsing of path
Closes #7199
2014-04-24 23:36:28 -07:00
Søren Louv-Jansen
e19dbc7793 docs(ngMock): fix example for $http respond() helper with function as 1st param
The  `whenPOST` method should return a response object containing status, response body and headers.
If omitted the following error will be thrown:

`Uncaught TypeError: Cannot read property '2' of undefined`

The documentation doesn't make it very clear, so I think it will be appropriate to add it here.

Closes #6761
2014-04-24 09:41:54 -04:00
benjamingr
06d0f1aea6 style(Angular.js): remove redundant _angular
Going through the commit history on GitHub, the `_angular` is for noConflict mode,
the case where you have an old reference to a variable called Angular you want to preserve.

Here is the commit that added _angular in : https://github.com/angular/angular.js/commit/
12ba6cec4f

This feature was later removed here:
9faabd1ba0

The variable 'made it through', it's redundant now.

Closes #7215
2014-04-24 11:42:01 +01:00
James deBoer
8377e81827 perf(scope): 10x. Share the child scope class.
This change causes Scope.$destory to run 10x faster. I suspect
Scope.$new is significantly faster as well, but I didn't measure it.
2014-04-23 13:46:34 -07:00
Peter Bacon Darwin
828ad89e8a docs(ngSwitch): fix formatting of custom usage field 2014-04-23 19:32:41 +01:00
Michał Gołębiowski
92e8289c12 refactor(jqLite): change leftover element.bind/unbind to element.on/off 2014-04-22 16:03:22 +02:00
Igor Minar
546cb429d9 perf($interpolate): speed up interpolation by recreating watchGroup approach
This change undoes the use of watchGroup by code that uses $interpolate, by
moving the optimizations into the $interpolate itself. While this is not ideal,
it means that we are making the existing api faster rather than require people
to use $interpolate differently in order to benefit from the speed improvements.
2014-04-21 11:48:38 -07:00
Igor Minar
1db3b8cfb7 refactor($interpolate): attempt to remove hacky code due to $interpolation perf improvements 2014-04-21 11:47:23 -07:00
rodyhaddad
0ebfa0d112 perf($compile): watch interpolated expressions individually 2014-04-21 11:12:35 -07:00
rodyhaddad
88c2193c71 refactor($interpolate): split .parts into .expressions and .separators
BREAKING CHANGE: the function returned by $interpolate
no longer has a `.parts` array set on it.
It has been replaced by two arrays:
* `.expressions`, an array of the expressions in the
  interpolated text. The expressions are parsed with
  $parse, with an extra layer converting them to strings
  when computed
* `.separators`, an array of strings representing the
  separations between interpolations in the text.
  This array is **always** 1 item longer than the
  `.expressions` array for easy merging with it
2014-04-21 11:12:35 -07:00
rodyhaddad
21f9316338 feat(Scope): add $watchGroup method for observing a set of expressions
Given an array of expressions, if any one expression changes then the listener function fires
with an arrays of old and new values.

$scope.watchGroup([expression1, expression2, expression3], function(newVals, oldVals) {
 // newVals and oldVals are arrays of values corresponding to expression1..3
 ...
});

Port of angular/angular.dart@a3c31ce1dd
2014-04-21 11:12:35 -07:00
Igor Minar
45c356586b chore(Scope): name the $watch deregistration function as 2014-04-18 16:32:07 -07:00
Caitlin Potter
64a3f42f14 style(input): fix trailing whitespace
Oops. I blame vim for this little accident.
2014-04-18 18:13:53 -04:00
Caitlin Potter
ff428e7283 fix(input): don't dirty model when input event triggered due to placeholder change
Certain versions of IE inexplicably trigger an input event in response to a placeholder
being set.

It is not possible to sniff for this behaviour nicely as the event is not triggered if
the element is not attached to the document, and the event triggers asynchronously so
it is not possible to accomplish this without deferring DOM compilation and slowing down
load times.

Closes #2614
Closes #5960
2014-04-18 17:47:25 -04:00
Janas Page
a990078173 docs(form.FormController): fix grammar 2014-04-18 16:42:27 -04:00
Chris Wheatley
f0407d2aa0 docs(ngMock): grammar fix
Small grammar fix for mock $httpBackend documentation.
2014-04-18 15:41:26 -04:00
Caitlin Potter
49e7c32bb4 fix($location): fix and test html5Mode url-parsing algorithm for legacy browsers
This CL fixes problems and adds test cases for changes from #6421. Changes
include fixing the algorithm for preprocessing href attribute values, as
well as supporting xlink:href attributes. Credit for the original URL
parsing algorithm still goes to @richardcrichardc.

Good work, champ!
2014-04-17 17:42:34 -04:00
Richard Collins
3f047704c7 fix($location): make legacy browsers behave like modern ones in html5Mode
Previously, LocationHashbangInHtml5Url, which is used when html5Mode is enabled
in browsers which do not support the history API (IE8/9), would behave very
inconsistently WRT relative URLs always being resolved relative to the app root
url.

This fix enables these legacy browsers to behave like history enabled browsers,
by processing href attributes in order to resolve urls correctly.

Closes #6162
Closes #6421
Closes #6899
Closes #6832
Closes #6834
2014-04-17 17:42:20 -04:00
Caitlin Potter
1192531e9b fix($compile): reference correct directive name in ctreq error
Previously, ctreq would possibly reference the incorrect directive name,
due to relying on a directiveName living outside of the closure which
throws the exception, which can change before the call is ever made.

This change saves the current value of directiveName as a property of
the link function, which prevents this from occurring.

Closes #7062
Closes #7067
2014-04-15 17:16:59 -04:00