Skip to content

Commit ef5dbed

Browse files
Merge pull request #42 from angular/master
Update upstream
2 parents 3087beb + 62743a5 commit ef5dbed

File tree

5 files changed

+323
-11
lines changed

5 files changed

+323
-11
lines changed

CHANGELOG.md

+22
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
<a name="1.6.8"></a>
2+
# 1.6.8 beneficial-tincture (2017-12-18)
3+
4+
5+
## Bug Fixes
6+
- **$location:**
7+
- always decode special chars in `$location.url(value)`
8+
([2bdf71](https://github.com/angular/angular.js/commit/2bdf7126878c87474bb7588ce093d0a3c57b0026))
9+
- decode non-component special chars in Hashbang URLS
10+
([57b626](https://github.com/angular/angular.js/commit/57b626a673b7530399d3377dfe770165bec35f8a))
11+
- **ngModelController:** allow $overrideModelOptions to set updateOn
12+
([55516d](https://github.com/angular/angular.js/commit/55516da2dfc7c5798dce24e9fa930c5ac90c900c),
13+
[#16351](https://github.com/angular/angular.js/issues/16351),
14+
[#16364](https://github.com/angular/angular.js/issues/16364))
15+
16+
17+
## New Features
18+
- **$parse:** add a hidden interface to retrieve an expression's AST
19+
([f33d95](https://github.com/angular/angular.js/commit/f33d95cfcff6fd0270f92a142df8794cca2013ad),
20+
[#16253](https://github.com/angular/angular.js/issues/16253),
21+
[#16260](https://github.com/angular/angular.js/issues/16260))
22+
123
<a name="1.6.7"></a>
224
# 1.6.7 imperial-backstroke (2017-11-24)
325

src/ng/filter/filters.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,14 @@ function currencyFilter($locale) {
6868
fractionSize = formats.PATTERNS[1].maxFrac;
6969
}
7070

71+
// If the currency symbol is empty, trim whitespace around the symbol
72+
var currencySymbolRe = !currencySymbol ? /\s*\u00A4\s*/g : /\u00A4/g;
73+
7174
// if null or undefined pass it through
7275
return (amount == null)
7376
? amount
7477
: formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
75-
replace(/\u00A4/g, currencySymbol);
78+
replace(currencySymbolRe, currencySymbol);
7679
};
7780
}
7881

src/ngResource/resource.js

+17-6
Original file line numberDiff line numberDiff line change
@@ -185,11 +185,12 @@ function shallowClearAndCopy(src, dst) {
185185
* for more information.
186186
* - **`responseType`** - `{string}` - see
187187
* [requestType](https://developer.mozilla.org/en-US/docs/DOM/XMLHttpRequest#responseType).
188-
* - **`interceptor`** - `{Object=}` - The interceptor object has two optional methods -
189-
* `response` and `responseError`. Both `response` and `responseError` interceptors get called
190-
* with `http response` object. See {@link ng.$http $http interceptors}. In addition, the
191-
* resource instance or array object is accessible by the `resource` property of the
192-
* `http response` object.
188+
* - **`interceptor`** - `{Object=}` - The interceptor object has four optional methods -
189+
* `request`, `requestError`, `response`, and `responseError`. See
190+
* {@link ng.$http $http interceptors} for details. Note that `request`/`requestError`
191+
* interceptors are applied before calling `$http`, thus before any global `$http` interceptors.
192+
* The resource instance or array object is accessible by the `resource` property of the
193+
* `http response` object passed to response interceptors.
193194
* Keep in mind that the associated promise will be resolved with the value returned by the
194195
* response interceptor, if one is specified. The default response interceptor returns
195196
* `response.resource` (i.e. the resource instance or array).
@@ -707,6 +708,9 @@ angular.module('ngResource', ['ng']).
707708
var isInstanceCall = this instanceof Resource;
708709
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
709710
var httpConfig = {};
711+
var requestInterceptor = action.interceptor && action.interceptor.request || undefined;
712+
var requestErrorInterceptor = action.interceptor && action.interceptor.requestError ||
713+
undefined;
710714
var responseInterceptor = action.interceptor && action.interceptor.response ||
711715
defaultResponseInterceptor;
712716
var responseErrorInterceptor = action.interceptor && action.interceptor.responseError ||
@@ -743,7 +747,14 @@ angular.module('ngResource', ['ng']).
743747
extend({}, extractParams(data, action.params || {}), params),
744748
action.url);
745749

746-
var promise = $http(httpConfig).then(function(response) {
750+
// Start the promise chain
751+
var promise = $q.
752+
resolve(httpConfig).
753+
then(requestInterceptor).
754+
catch(requestErrorInterceptor).
755+
then($http);
756+
757+
promise = promise.then(function(response) {
747758
var data = response.data;
748759

749760
if (data) {

test/ng/filter/filtersSpec.js

+13
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,19 @@ describe('filters', function() {
186186

187187
expect(currency(1.07)).toBe('$1.1');
188188
}));
189+
190+
it('should trim whitespace around the currency symbol if it is empty',
191+
inject(function($locale) {
192+
var pattern = $locale.NUMBER_FORMATS.PATTERNS[1];
193+
pattern.posPre = pattern.posSuf = ' \u00A4 ';
194+
pattern.negPre = pattern.negSuf = ' - \u00A4 - ';
195+
196+
expect(currency(+1.07, '$')).toBe(' $ 1.07 $ ');
197+
expect(currency(-1.07, '$')).toBe(' - $ - 1.07 - $ - ');
198+
expect(currency(+1.07, '')).toBe('1.07');
199+
expect(currency(-1.07, '')).toBe(' -- 1.07 -- ');
200+
})
201+
);
189202
});
190203

191204
describe('number', function() {

0 commit comments

Comments
 (0)