Skip to content

Update upstream #42

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 19, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,25 @@
<a name="1.6.8"></a>
# 1.6.8 beneficial-tincture (2017-12-18)


## Bug Fixes
- **$location:**
- always decode special chars in `$location.url(value)`
([2bdf71](https://github.com/angular/angular.js/commit/2bdf7126878c87474bb7588ce093d0a3c57b0026))
- decode non-component special chars in Hashbang URLS
([57b626](https://github.com/angular/angular.js/commit/57b626a673b7530399d3377dfe770165bec35f8a))
- **ngModelController:** allow $overrideModelOptions to set updateOn
([55516d](https://github.com/angular/angular.js/commit/55516da2dfc7c5798dce24e9fa930c5ac90c900c),
[#16351](https://github.com/angular/angular.js/issues/16351),
[#16364](https://github.com/angular/angular.js/issues/16364))


## New Features
- **$parse:** add a hidden interface to retrieve an expression's AST
([f33d95](https://github.com/angular/angular.js/commit/f33d95cfcff6fd0270f92a142df8794cca2013ad),
[#16253](https://github.com/angular/angular.js/issues/16253),
[#16260](https://github.com/angular/angular.js/issues/16260))

<a name="1.6.7"></a>
# 1.6.7 imperial-backstroke (2017-11-24)

Expand Down
5 changes: 4 additions & 1 deletion src/ng/filter/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,14 @@ function currencyFilter($locale) {
fractionSize = formats.PATTERNS[1].maxFrac;
}

// If the currency symbol is empty, trim whitespace around the symbol
var currencySymbolRe = !currencySymbol ? /\s*\u00A4\s*/g : /\u00A4/g;

// if null or undefined pass it through
return (amount == null)
? amount
: formatNumber(amount, formats.PATTERNS[1], formats.GROUP_SEP, formats.DECIMAL_SEP, fractionSize).
replace(/\u00A4/g, currencySymbol);
replace(currencySymbolRe, currencySymbol);
};
}

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

var promise = $http(httpConfig).then(function(response) {
// Start the promise chain
var promise = $q.
resolve(httpConfig).
then(requestInterceptor).
catch(requestErrorInterceptor).
then($http);

promise = promise.then(function(response) {
var data = response.data;

if (data) {
Expand Down
13 changes: 13 additions & 0 deletions test/ng/filter/filtersSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,19 @@ describe('filters', function() {

expect(currency(1.07)).toBe('$1.1');
}));

it('should trim whitespace around the currency symbol if it is empty',
inject(function($locale) {
var pattern = $locale.NUMBER_FORMATS.PATTERNS[1];
pattern.posPre = pattern.posSuf = ' \u00A4 ';
pattern.negPre = pattern.negSuf = ' - \u00A4 - ';

expect(currency(+1.07, '$')).toBe(' $ 1.07 $ ');
expect(currency(-1.07, '$')).toBe(' - $ - 1.07 - $ - ');
expect(currency(+1.07, '')).toBe('1.07');
expect(currency(-1.07, '')).toBe(' -- 1.07 -- ');
})
);
});

describe('number', function() {
Expand Down
Loading