Commit 6a65d06f authored by Pascal Hartig's avatar Pascal Hartig

AngularJS: Upgrade to 1.3.2

parent b326cd3c
...@@ -2,11 +2,11 @@ ...@@ -2,11 +2,11 @@
"name": "todomvc-angular", "name": "todomvc-angular",
"version": "0.0.0", "version": "0.0.0",
"dependencies": { "dependencies": {
"angular": "1.3.0", "angular": "1.3.2",
"todomvc-common": "~0.3.0" "todomvc-common": "~0.3.0"
}, },
"devDependencies": { "devDependencies": {
"angular-mocks": "1.3.0", "angular-mocks": "1.3.2",
"angular-route": "1.3.0" "angular-route": "1.3.2"
} }
} }
/** /**
* @license AngularJS v1.3.0 * @license AngularJS v1.3.2
* (c) 2010-2014 Google, Inc. http://angularjs.org * (c) 2010-2014 Google, Inc. http://angularjs.org
* License: MIT * License: MIT
*/ */
...@@ -39,7 +39,7 @@ var ngRouteModule = angular.module('ngRoute', ['ng']). ...@@ -39,7 +39,7 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
* ## Dependencies * ## Dependencies
* Requires the {@link ngRoute `ngRoute`} module to be installed. * Requires the {@link ngRoute `ngRoute`} module to be installed.
*/ */
function $RouteProvider(){ function $RouteProvider() {
function inherit(parent, extra) { function inherit(parent, extra) {
return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra); return angular.extend(new (angular.extend(function() {}, {prototype:parent}))(), extra);
} }
...@@ -146,10 +146,14 @@ function $RouteProvider(){ ...@@ -146,10 +146,14 @@ function $RouteProvider(){
* Adds a new route definition to the `$route` service. * Adds a new route definition to the `$route` service.
*/ */
this.when = function(path, route) { this.when = function(path, route) {
//copy original route object to preserve params inherited from proto chain
var routeCopy = angular.copy(route);
if (angular.isUndefined(routeCopy.reloadOnSearch)) {
routeCopy.reloadOnSearch = true;
}
routes[path] = angular.extend( routes[path] = angular.extend(
{reloadOnSearch: true}, routeCopy,
route, path && pathRegExp(path, routeCopy)
path && pathRegExp(path, route)
); );
// create redirection for trailing slashes // create redirection for trailing slashes
...@@ -160,7 +164,7 @@ function $RouteProvider(){ ...@@ -160,7 +164,7 @@ function $RouteProvider(){
routes[redirectPath] = angular.extend( routes[redirectPath] = angular.extend(
{redirectTo: path}, {redirectTo: path},
pathRegExp(redirectPath, route) pathRegExp(redirectPath, routeCopy)
); );
} }
...@@ -188,7 +192,7 @@ function $RouteProvider(){ ...@@ -188,7 +192,7 @@ function $RouteProvider(){
path = path path = path
.replace(/([().])/g, '\\$1') .replace(/([().])/g, '\\$1')
.replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option){ .replace(/(\/)?:(\w+)([\?\*])?/g, function(_, slash, key, option) {
var optional = option === '?' ? option : null; var optional = option === '?' ? option : null;
var star = option === '*' ? option : null; var star = option === '*' ? option : null;
keys.push({ name: key, optional: !!optional }); keys.push({ name: key, optional: !!optional });
...@@ -442,7 +446,7 @@ function $RouteProvider(){ ...@@ -442,7 +446,7 @@ function $RouteProvider(){
* {@link ng.$location $location} hasn't changed. * {@link ng.$location $location} hasn't changed.
* *
* As a result of that, {@link ngRoute.directive:ngView ngView} * As a result of that, {@link ngRoute.directive:ngView ngView}
* creates new scope, reinstantiates the controller. * creates new scope and reinstantiates the controller.
*/ */
reload: function() { reload: function() {
forceReload = true; forceReload = true;
...@@ -870,7 +874,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory); ...@@ -870,7 +874,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
* Emitted every time the ngView content is reloaded. * Emitted every time the ngView content is reloaded.
*/ */
ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate']; ngViewFactory.$inject = ['$route', '$anchorScroll', '$animate'];
function ngViewFactory( $route, $anchorScroll, $animate) { function ngViewFactory($route, $anchorScroll, $animate) {
return { return {
restrict: 'ECA', restrict: 'ECA',
terminal: true, terminal: true,
...@@ -887,16 +891,16 @@ function ngViewFactory( $route, $anchorScroll, $animate) { ...@@ -887,16 +891,16 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
update(); update();
function cleanupLastView() { function cleanupLastView() {
if(previousLeaveAnimation) { if (previousLeaveAnimation) {
$animate.cancel(previousLeaveAnimation); $animate.cancel(previousLeaveAnimation);
previousLeaveAnimation = null; previousLeaveAnimation = null;
} }
if(currentScope) { if (currentScope) {
currentScope.$destroy(); currentScope.$destroy();
currentScope = null; currentScope = null;
} }
if(currentElement) { if (currentElement) {
previousLeaveAnimation = $animate.leave(currentElement); previousLeaveAnimation = $animate.leave(currentElement);
previousLeaveAnimation.then(function() { previousLeaveAnimation.then(function() {
previousLeaveAnimation = null; previousLeaveAnimation = null;
...@@ -920,7 +924,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) { ...@@ -920,7 +924,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
// function is called before linking the content, which would apply child // function is called before linking the content, which would apply child
// directives to non existing elements. // directives to non existing elements.
var clone = $transclude(newScope, function(clone) { var clone = $transclude(newScope, function(clone) {
$animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter () { $animate.enter(clone, null, currentElement || $element).then(function onNgViewEnter() {
if (angular.isDefined(autoScrollExp) if (angular.isDefined(autoScrollExp)
&& (!autoScrollExp || scope.$eval(autoScrollExp))) { && (!autoScrollExp || scope.$eval(autoScrollExp))) {
$anchorScroll(); $anchorScroll();
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment