aboutsummaryrefslogtreecommitdiffstats
path: root/src/ngResource/resource.js
AgeCommit message (Collapse)Author
2014-03-13docs($resource): fix example using promiseWesley Cho
2014-03-02docs(*): ensure jsdoc type expressions are validPeter Bacon Darwin
2014-02-19docs(modules): remove unused {@installModule} tagsPeter Bacon Darwin
2014-02-18style: remove ws and enfore no-trailing-ws jscs ruleIgor Minar
2014-02-16docs(api): escape params that have <object> in their typePeter Bacon Darwin
Really the doc-gen process should escape there but for now this should stop the layout from breaking.
2014-02-16docs(ngResource): fix over-length linePeter Bacon Darwin
2014-02-16docs(bike-shed-migration): let markdown deal with extenal linksPeter Bacon Darwin
It is problematic to use {@link} tags with external links because the markdown parser converts them to links for us before we parse the @links. This means that the following tag: ``` {@link http://www.google.com Google} ``` get converted to: ``` {@link <a href="http://www.google.com/"></a> Google} ``` Our {@link} parser then converts this to: ``` <a href="<a">&lt;</a>href="http://www.google.com/"></a> Google} ``` which is clearly a mess. The best solution is not to use {@link} tags for external links and just use the standard markdown syntax: ``` [Google](http://www.google.com) ``` In the long run, we could look into configuring or modifying `marked` not to convert these external links or we could provide a "pre-parser" processor that dealt with such links before `marked` gets its hands on it.
2014-02-16docs(all): convert <pre>/</pre> snippets to GFM snippetsCaitlin Potter
2014-02-16docs(bike-shed-migration): convert doctype and namesPeter Bacon Darwin
2014-02-04fix(ngResource): don't filter "$"-prefixed properties from ngResource ↵Thomas Belin
requests/responses ngResource no longer filters properties prefixed with a single "$" character from requests or responses, correcting a regression introduced in 1.2.6 (cb29632a) which caused shallowCopy and shallowClearAndCopy to ignore properties prefixed with a single "$". Closes #5666 Closes #6080 Closes #6033
2014-02-03fix(ngResource): don't append number to '$' in url param value when encoding URICaitlin Potter
Previously, if a URL parameter value included a $, it would replace the dollar sign with a literal '$1' for mysterious reasons. Using a function rather than a replacement string circumvents this behaviour and produces a more expected result. Closes #6003 Closes #6004
2014-01-10docs(\$resource): fixed typo (s/seapph/search)René Wilhelm
Closes #5718
2014-01-02fix($resource): prevent URL template from collapsing into an empty stringGias Kay Lee
if url template would result in an empty string, we should make a request to '/' instead. Closes #5455 Closes #5493
2013-12-18docs($resource): fix typo in server response exampleoweitz
The server is supposed to return the same card number as in the client request. Adjust server response example to the value given in the client request. Closes #5352
2013-12-17perf: use faster check for $$ prefixKarl Seamon
Use two calls to charAt instead of substr to detect a $$prefix in the shallowCopy functions. This makes shallowCopy 25-50% faster (depending on which browser is used). http://jsperf.com/angular-shallow-copy Closes #5457
2013-12-17docs(): fix jshint issuesPete Bacon Darwin
2013-12-17docs($resource): add example for a custom PUT requestunclejustin
Closes #5302
2013-12-13perf($resource): use shallow copy instead of angular.copyKarl Seamon
Replace calls to angular.copy with calls to a new function, shallowClearAndCopy. Add calls to copy for cache access in $http in order to prevent modification of cached data. Results in a measurable improvement to the startup time of complex apps within Google. Closes #5300
2013-12-06revert: chore($resource): Use shallow copy instead of angular.copyMatias Niemelä
2013-12-05chore($resource): Use shallow copy instead of angular.copyKarl Seamon
Replace calls to angular.copy with calls to a new function, shallowClearAndCopy. Add calls to copy for cache access in $http in order to prevent modification of cached data. Results in a measurable improvement to the startup time of complex apps within Google. Closes #5300
2013-11-21fix($resource): Always return a resource instance when calling class methods ↵Tobias Bosch
on resources. Previously, calling `MyResource.save(myResourceInstance)`returned a promise, in contrast to the docs for `$resource`. However, calling `MyResource.save({name: 'Tobias"})`already correctly returned a resource instance. Fixes #4545. Closes #5061.
2013-11-14docs(ngResource): removed buzz client exampleJeff Cross
The Buzz Client example on the ngResource doc was causing parse errors. While the root cause is being investigated, the example has been removed, and should be replaced by a more relevant example anyhow.
2013-11-14docs(resource): fix grammatical issuemkolodny
'Case' should be the plural 'cases' since it is talking about multiple possible cases rather than a single case. For slightly more info, see the section 'When words like "none" are the subject' in this article: http://writing.wisc.edu/Handbook/SubjectVerb.html
2013-11-11fix($resource): don't use $parse for @dotted.memberChirayu Krishnappa
params and paramDefaults support looking up the parameter value from the data object. The syntax for that is `@nested.property.name`. Currently, $resource uses $parse to do this. This is too liberal (you can use values like `@a=b` or `@a | filter` and have it work - which doesn't really make sense). It also puts up a dependency on $parse which is has restrictions to secure expressions used in templates. The value here, though a string, is specified in Javascript code and shouldn't have those restrictions.
2013-10-27docs($resource): fix typoJarrett Harris
Closes #4670
2013-10-23chore(docs): fix jsHint errors with long linesMatias Niemelä
2013-10-23feat(docs): provide index pages for each angular moduleMatias Niemelä
2013-10-22style: make jshint happyVojta Jina
2013-10-18docs: correct broken linksVojta Jina
This also contains some whitespace corrections by my editor.
2013-10-07fix(*): protect calls to hasOwnProperty in public APIPeter Bacon Darwin
Objects received from outside AngularJS may have had their `hasOwnProperty` method overridden with something else. In cases where we can do this without incurring a performance penalty we call directly on Object.prototype.hasOwnProperty to ensure that we use the correct method. Also, we have some internal hash objects, where the keys for the map are provided from outside AngularJS. In such cases we either prevent `hasOwnProperty` from being used as a key or provide some other way of preventing our objects from having their `hasOwnProperty` overridden. BREAKING CHANGE: Inputs with name equal to "hasOwnProperty" are not allowed inside form or ngForm directives. Before, inputs whose name was "hasOwnProperty" were quietly ignored and not added to the scope. Now a badname exception is thrown. Using "hasOwnProperty" for an input name would be very unusual and bad practice. Either do not include such an input in a `form` or `ngForm` directive or change the name of the input. Closes #3331
2013-10-05docs($resource): remove extra "to" from $resource docsDavid Barker
Closes #4287
2013-10-04fix(ngResource): Remove request body from $deleteJen Bourey
Prevent the obj.$delete instance method from sending the resource as the request body. This commit uses the existing hasBody boolean to only set httpConfig.data for methods which should have a request body. Closes #4280
2013-10-02fix($resource): pass transformed value to both callbacks and promisesjankuca
Closes #3817
2013-09-18docs(ngResource): fix typoTim Statler
Closes #3835
2013-08-22docs(module): improve the installation instructions for optional modulesBrian Ford
Currently, the documentation does a bad job of explaining the distinction between the services that it provides, and the module itself. Furthermore, the instructions for using optional modules are inconsistent or missing. This commit addresses the problem by ading a new `{@installModule foo}` annotation to the docs generator that inlines the appropriate instructions based on the name of the module.
2013-08-21fix(docs): Replace missing end tilde in resource docs for minerr.Adam Shannon
2013-08-09style(minerr): prefer component name as namespaceKen Sheedlo
Closes #3527
2013-07-31fix(resource): check whether response matches action.isArrayPete Bacon Darwin
When using $resource you must setup your actions carefully based on what the server returns. If the server responds to a request with an array then you must configure the action with `isArray:true` and vice versa. The built-in `get` action defaults to `isArray:false` and the `query` action defaults to `isArray:true`, which is must be changed if the server does not do this. Before the error message was an exception inside angular.copy, which didn't explain what the real problem was. Rather than changing the way that angular.copy works, this change ensures that a better error message is provided to the programmer if they do not set up their resource actions correctly. Closes #2255, #1044
2013-07-18feat(Angular): provide minErr as public propertyPete Bacon Darwin
This allows us to use minErr in other modules, such as resource and sanitize.
2013-07-18chore(resource): use minErr to throw exceptionPete Bacon Darwin
2013-07-12feat($resource): support an unescaped URL portLeandro Ostera
The colon character is used to identify parameters in $resource. This meant that we had to escape the colon used in a port. It turns out that this is not necessary if we assume that parameter names cannot consist of only digits. If the parameter consists only of numbers, then it's a port. Closes #2778
2013-06-06refactor($route): pull $route and friends into angular-route.jsIgor Minar
$route, $routeParams and ngView have been pulled from core angular.js to angular-route.js/ngRoute module. This is was done to in order keep the core focused on most commonly used functionality and allow community routers to be freely used instead of $route service. There is no need to panic, angular-route will keep on being supported by the angular team. Note: I'm intentionally not fixing tutorial links. Tutorial will need bigger changes and those should be done when we update tutorial to 1.2. BREAKING CHANGE: applications that use $route will now need to load angular-route.js file and define dependency on ngRoute module. Before: ``` ... <script src="angular.js"></script> ... var myApp = angular.module('myApp', ['someOtherModule']); ... ``` After: ``` ... <script src="angular.js"></script> <script src="angular-route.js"></script> ... var myApp = angular.module('myApp', ['ngRoute', 'someOtherModule']); ... ``` Closes #2804
2013-05-23feat($resource): expose promise instead of only $thenAlexander Shtuchkin
- Instance or collection have `$promise` property which is the initial promise. - Add per-action `interceptor`, which has access to entire $http response object. BREAKING CHANGE: resource instance does not have `$then` function anymore. Before: Resource.query().$then(callback); After: Resource.query().$promise.then(callback); BREAKING CHANGE: instance methods return the promise rather than the instance itself. Before: resource.$save().chaining = true; After: resource.$save(); resourve.chaining = true; BREAKING CHANGE: On success, promise is resolved with the resource instance rather than http response object. Use interceptor to access the http response object. Before: Resource.query().$then(function(response) {...}); After: var Resource = $resource('/url', {}, { get: { method: 'get', interceptor: { response: function(response) { // expose response return response; } } } });
2013-05-20feat($http): add support for aborting via timeout promisesDavid Bennett
If the timeout argument is a promise, abort the request when it is resolved. Implemented by adding support to $httpBackend service and $httpBackend mock service. This api can also be used to explicitly abort requests while keeping the communication between the deffered and promise unidirectional. Closes #1159
2013-05-16fix($resource): null default param results in TypeErrorRyan Schumacher
Fixes issue when setting a default param as `null` error `TypeError: Cannot read property 'charAt' of null`
2013-05-14feat($resource): collapse empty suffix parameters correctlyGlenn Goodrich
Previously only repeated `/` delimiters were collapsed into a single `/`. Now, the sequence `/.` at the end of the template, i.e. only followed by a sequence of word characters, is collapsed into a single `.`. This makes it easier to support suffixes on resource URLs. For example, given a resource template of `/some/path/:id.:format`, if the `:id` is `""` but format `"json"` then the URL is now `/some/path.json`, rather than `/some/path/.json`. BREAKING CHANGE: A `/` followed by a `.`, in the last segment of the URL template is now collapsed into a single `.` delimiter. For example: `users/.json` will become `users.json`. If your server relied upon this sequence then it will no longer work. In this case you can now escape the `/.` sequence with `/\.`
2013-05-08refactor($resource): simplify url template expansionIgor Minar
2013-04-04docs($resource): improve installation sectionIgor Minar
2013-03-29docs(*): fixed typosPascal Borreli
2013-03-08docs($resource): Added an installation section.Ciro Nunes