Permalink
Browse files

upgrade to angular 1.0.4

  • Loading branch information...
1 parent 0bab901 commit 385c6b273ac023280ec4b003288f099c3219f5d2 @clkao committed Feb 16, 2013
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.1
+ * @license AngularJS v1.0.4
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.1
+ * @license AngularJS v1.0.4
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -36,7 +36,7 @@ function setupModuleLoader(window) {
*
* # Module
*
- * A module is a collocation of services, directives, filters, and configure information. Module
+ * A module is a collocation of services, directives, filters, and configuration information. Module
* is used to configure the {@link AUTO.$injector $injector}.
*
* <pre>
@@ -67,7 +67,7 @@ function setupModuleLoader(window) {
* @param {!string} name The name of the module to create or retrieve.
* @param {Array.<string>=} requires If specified then new module is being created. If unspecified then the
* the module is being retrieved for further configuration.
- * @param {Function} configFn Option configuration function for the module. Same as
+ * @param {Function} configFn Optional configuration function for the module. Same as
* {@link angular.Module#config Module#config()}.
* @returns {module} new module with the {@link angular.Module} api.
*/
@@ -200,7 +200,7 @@ function setupModuleLoader(window) {
* @param {Function} directiveFactory Factory function for creating new instance of
* directives.
* @description
- * See {@link ng.$compileProvider.directive $compileProvider.directive()}.
+ * See {@link ng.$compileProvider#directive $compileProvider.directive()}.
*/
directive: invokeLater('$compileProvider', 'directive'),
@@ -222,8 +222,8 @@ function setupModuleLoader(window) {
* @param {Function} initializationFn Execute this function after injector creation.
* Useful for application initialization.
* @description
- * Use this method to register work which needs to be performed when the injector with
- * with the current module is finished loading.
+ * Use this method to register work which should be performed when the injector is done
+ * loading all modules.
*/
run: function(block) {
runBlocks.push(block);
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.1
+ * @license AngularJS v1.0.4
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -12,7 +12,7 @@
* @description
*/
- /**
+/**
* @ngdoc object
* @name ngResource.$resource
* @requires $http
@@ -25,7 +25,9 @@
* the need to interact with the low level {@link ng.$http $http} service.
*
* @param {string} url A parameterized URL template with parameters prefixed by `:` as in
- * `/user/:username`.
+ * `/user/:username`. If you are using a URL with a port number (e.g.
+ * `http://example.com:8080/api`), you'll need to escape the colon character before the port
+ * number, like this: `$resource('http://example.com\\:8080/api')`.
*
* @param {Object=} paramDefaults Default values for `url` parameters. These can be overridden in
* `actions` methods.
@@ -230,46 +232,46 @@ angular.module('ngResource', ['ng']).
return $parse(path)(obj);
};
- /**
- * We need our custom mehtod because encodeURIComponent is too agressive and doesn't follow
- * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
- * segments:
- * segment = *pchar
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- * pct-encoded = "%" HEXDIG HEXDIG
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
- * / "*" / "+" / "," / ";" / "="
- */
- function encodeUriSegment(val) {
- return encodeUriQuery(val, true).
- replace(/%26/gi, '&').
- replace(/%3D/gi, '=').
- replace(/%2B/gi, '+');
- }
-
-
- /**
- * This method is intended for encoding *key* or *value* parts of query component. We need a custom
- * method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be
- * encoded per http://tools.ietf.org/html/rfc3986:
- * query = *( pchar / "/" / "?" )
- * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
- * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
- * pct-encoded = "%" HEXDIG HEXDIG
- * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
- * / "*" / "+" / "," / ";" / "="
- */
- function encodeUriQuery(val, pctEncodeSpaces) {
- return encodeURIComponent(val).
- replace(/%40/gi, '@').
- replace(/%3A/gi, ':').
- replace(/%24/g, '$').
- replace(/%2C/gi, ',').
- replace((pctEncodeSpaces ? null : /%20/g), '+');
- }
-
- function Route(template, defaults) {
+ /**
+ * We need our custom method because encodeURIComponent is too aggressive and doesn't follow
+ * http://www.ietf.org/rfc/rfc3986.txt with regards to the character set (pchar) allowed in path
+ * segments:
+ * segment = *pchar
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+ function encodeUriSegment(val) {
+ return encodeUriQuery(val, true).
+ replace(/%26/gi, '&').
+ replace(/%3D/gi, '=').
+ replace(/%2B/gi, '+');
+ }
+
+
+ /**
+ * This method is intended for encoding *key* or *value* parts of query component. We need a custom
+ * method becuase encodeURIComponent is too agressive and encodes stuff that doesn't have to be
+ * encoded per http://tools.ietf.org/html/rfc3986:
+ * query = *( pchar / "/" / "?" )
+ * pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
+ * unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
+ * pct-encoded = "%" HEXDIG HEXDIG
+ * sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
+ * / "*" / "+" / "," / ";" / "="
+ */
+ function encodeUriQuery(val, pctEncodeSpaces) {
+ return encodeURIComponent(val).
+ replace(/%40/gi, '@').
+ replace(/%3A/gi, ':').
+ replace(/%24/g, '$').
+ replace(/%2C/gi, ',').
+ replace((pctEncodeSpaces ? null : /%20/g), '+');
+ }
+
+ function Route(template, defaults) {
this.template = template = template + '#';
this.defaults = defaults || {};
var urlParams = this.urlParams = {};
@@ -285,12 +287,25 @@ angular.module('ngResource', ['ng']).
url: function(params) {
var self = this,
url = this.template,
+ val,
encodedVal;
params = params || {};
forEach(this.urlParams, function(_, urlParam){
- encodedVal = encodeUriSegment(params[urlParam] || self.defaults[urlParam] || "");
- url = url.replace(new RegExp(":" + urlParam + "(\\W)"), encodedVal + "$1");
+ val = params.hasOwnProperty(urlParam) ? params[urlParam] : self.defaults[urlParam];
+ if (angular.isDefined(val) && val !== null) {
+ encodedVal = encodeUriSegment(val);
+ url = url.replace(new RegExp(":" + urlParam + "(\\W)", "g"), encodedVal + "$1");
+ } else {
+ url = url.replace(new RegExp("(\/?):" + urlParam + "(\\W)", "g"), function(match,
+ leadingSlashes, tail) {
+ if (tail.charAt(0) == '/') {
+ return tail;
+ } else {
+ return leadingSlashes + tail;
+ }
+ });
+ }
});
url = url.replace(/\/?#$/, '');
var query = [];
@@ -311,9 +326,10 @@ angular.module('ngResource', ['ng']).
actions = extend({}, DEFAULT_ACTIONS, actions);
- function extractParams(data){
+ function extractParams(data, actionParams){
var ids = {};
- forEach(paramDefaults || {}, function(value, key){
+ actionParams = extend({}, paramDefaults, actionParams);
+ forEach(actionParams, function(value, key){
ids[key] = value.charAt && value.charAt(0) == '@' ? getter(data, value.substr(1)) : value;
});
return ids;
@@ -324,6 +340,7 @@ angular.module('ngResource', ['ng']).
}
forEach(actions, function(action, name) {
+ action.method = angular.uppercase(action.method);
var hasBody = action.method == 'POST' || action.method == 'PUT' || action.method == 'PATCH';
Resource[name] = function(a1, a2, a3, a4) {
var params = {};
@@ -367,7 +384,7 @@ angular.module('ngResource', ['ng']).
var value = this instanceof Resource ? this : (action.isArray ? [] : new Resource(data));
$http({
method: action.method,
- url: route.url(extend({}, extractParams(data), action.params || {}, params)),
+ url: route.url(extend({}, extractParams(data, action.params || {}), params)),
data: data
}).then(function(response) {
var data = response.data;
@@ -389,11 +406,6 @@ angular.module('ngResource', ['ng']).
};
- Resource.bind = function(additionalParamDefaults){
- return ResourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
- };
-
-
Resource.prototype['$' + name] = function(a1, a2, a3) {
var params = extractParams(this),
success = noop,
@@ -419,6 +431,11 @@ angular.module('ngResource', ['ng']).
Resource[name].call(this, params, data, success, error);
};
});
+
+ Resource.bind = function(additionalParamDefaults){
+ return ResourceFactory(url, extend({}, paramDefaults, additionalParamDefaults), actions);
+ };
+
return Resource;
}
@@ -1,5 +1,5 @@
/**
- * @license AngularJS v1.0.1
+ * @license AngularJS v1.0.4
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@@ -416,7 +416,7 @@ angular.module('ngSanitize', []).value('$sanitize', $sanitize);
angular.module('ngSanitize').directive('ngBindHtml', ['$sanitize', function($sanitize) {
return function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
- scope.$watch(attr.ngBindHtml, function(value) {
+ scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
value = $sanitize(value);
element.html(value || '');
});
@@ -434,6 +434,9 @@ angular.module('ngSanitize').directive('ngBindHtml', ['$sanitize', function($san
* @param {string} text Input text.
* @returns {string} Html-linkified text.
*
+ * @usage
+ <span ng-bind-html="linky_expression | linky"></span>
+ *
* @example
<doc:example module="ngSanitize">
<doc:source>
Oops, something went wrong. Retry.

0 comments on commit 385c6b2

Please sign in to comment.