1
1
/**
2
- * @license AngularJS v1.3.0 -build.3341 +sha.7b6c1d0
2
+ * @license AngularJS v1.2.27 -build.496 +sha.d7c084f
3
3
* (c) 2010-2014 Google, Inc. http://angularjs.org
4
4
* License: MIT
5
5
*/
22
22
*/
23
23
/* global -ngRouteModule */
24
24
var ngRouteModule = angular . module ( 'ngRoute' , [ 'ng' ] ) .
25
- provider ( '$route' , $RouteProvider ) ,
26
- $routeMinErr = angular . $$minErr ( 'ngRoute' ) ;
25
+ provider ( '$route' , $RouteProvider ) ;
27
26
28
27
/**
29
28
* @ngdoc provider
30
29
* @name $routeProvider
30
+ * @kind function
31
31
*
32
32
* @description
33
33
*
@@ -216,14 +216,10 @@ function $RouteProvider(){
216
216
* Sets route definition that will be used on route change when no other route definition
217
217
* is matched.
218
218
*
219
- * @param {Object|string } params Mapping information to be assigned to `$route.current`.
220
- * If called with a string, the value maps to `redirectTo`.
219
+ * @param {Object } params Mapping information to be assigned to `$route.current`.
221
220
* @returns {Object } self
222
221
*/
223
222
this . otherwise = function ( params ) {
224
- if ( typeof params === 'string' ) {
225
- params = { redirectTo : params } ;
226
- }
227
223
this . when ( null , params ) ;
228
224
return this ;
229
225
} ;
@@ -234,9 +230,10 @@ function $RouteProvider(){
234
230
'$routeParams' ,
235
231
'$q' ,
236
232
'$injector' ,
237
- '$templateRequest' ,
233
+ '$http' ,
234
+ '$templateCache' ,
238
235
'$sce' ,
239
- function ( $rootScope , $location , $routeParams , $q , $injector , $templateRequest , $sce ) {
236
+ function ( $rootScope , $location , $routeParams , $q , $injector , $http , $templateCache , $sce ) {
240
237
241
238
/**
242
239
* @ngdoc service
@@ -441,36 +438,6 @@ function $RouteProvider(){
441
438
reload : function ( ) {
442
439
forceReload = true ;
443
440
$rootScope . $evalAsync ( updateRoute ) ;
444
- } ,
445
-
446
- /**
447
- * @ngdoc method
448
- * @name $route#updateParams
449
- *
450
- * @description
451
- * Causes `$route` service to update the current URL, replacing
452
- * current route parameters with those specified in `newParams`.
453
- * Provided property names that match the route's path segment
454
- * definitions will be interpolated into the location's path, while
455
- * remaining properties will be treated as query params.
456
- *
457
- * @param {Object } newParams mapping of URL parameter names to values
458
- */
459
- updateParams : function ( newParams ) {
460
- if ( this . current && this . current . $$route ) {
461
- var searchParams = { } , self = this ;
462
-
463
- angular . forEach ( Object . keys ( newParams ) , function ( key ) {
464
- if ( ! self . current . pathParams [ key ] ) searchParams [ key ] = newParams [ key ] ;
465
- } ) ;
466
-
467
- newParams = angular . extend ( { } , this . current . params , newParams ) ;
468
- $location . path ( interpolate ( this . current . $$route . originalPath , newParams ) ) ;
469
- $location . search ( angular . extend ( { } , $location . search ( ) , searchParams ) ) ;
470
- }
471
- else {
472
- throw $routeMinErr ( 'norout' , 'Tried updating route when with no current route' ) ;
473
- }
474
441
}
475
442
} ;
476
443
@@ -546,7 +513,7 @@ function $RouteProvider(){
546
513
547
514
angular . forEach ( locals , function ( value , key ) {
548
515
locals [ key ] = angular . isString ( value ) ?
549
- $injector . get ( value ) : $injector . invoke ( value , null , null , key ) ;
516
+ $injector . get ( value ) : $injector . invoke ( value ) ;
550
517
} ) ;
551
518
552
519
if ( angular . isDefined ( template = next . template ) ) {
@@ -560,7 +527,8 @@ function $RouteProvider(){
560
527
templateUrl = $sce . getTrustedResourceUrl ( templateUrl ) ;
561
528
if ( angular . isDefined ( templateUrl ) ) {
562
529
next . loadedTemplateUrl = templateUrl ;
563
- template = $templateRequest ( templateUrl ) ;
530
+ template = $http . get ( templateUrl , { cache : $templateCache } ) .
531
+ then ( function ( response ) { return response . data ; } ) ;
564
532
}
565
533
}
566
534
if ( angular . isDefined ( template ) ) {
@@ -722,6 +690,7 @@ ngRouteModule.directive('ngView', ngViewFillContentFactory);
722
690
<pre>$location.path() = {{main.$location.path()}}</pre>
723
691
<pre>$route.current.templateUrl = {{main.$route.current.templateUrl}}</pre>
724
692
<pre>$route.current.params = {{main.$route.current.params}}</pre>
693
+ <pre>$route.current.scope.name = {{main.$route.current.scope.name}}</pre>
725
694
<pre>$routeParams = {{main.$routeParams}}</pre>
726
695
</div>
727
696
</file>
@@ -854,28 +823,27 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
854
823
link : function ( scope , $element , attr , ctrl , $transclude ) {
855
824
var currentScope ,
856
825
currentElement ,
857
- previousLeaveAnimation ,
826
+ previousElement ,
858
827
autoScrollExp = attr . autoscroll ,
859
828
onloadExp = attr . onload || '' ;
860
829
861
830
scope . $on ( '$routeChangeSuccess' , update ) ;
862
831
update ( ) ;
863
832
864
833
function cleanupLastView ( ) {
865
- if ( previousLeaveAnimation ) {
866
- $animate . cancel ( previousLeaveAnimation ) ;
867
- previousLeaveAnimation = null ;
834
+ if ( previousElement ) {
835
+ previousElement . remove ( ) ;
836
+ previousElement = null ;
868
837
}
869
-
870
838
if ( currentScope ) {
871
839
currentScope . $destroy ( ) ;
872
840
currentScope = null ;
873
841
}
874
842
if ( currentElement ) {
875
- previousLeaveAnimation = $animate . leave ( currentElement ) ;
876
- previousLeaveAnimation . then ( function ( ) {
877
- previousLeaveAnimation = null ;
843
+ $animate . leave ( currentElement , function ( ) {
844
+ previousElement = null ;
878
845
} ) ;
846
+ previousElement = currentElement ;
879
847
currentElement = null ;
880
848
}
881
849
}
@@ -895,7 +863,7 @@ function ngViewFactory( $route, $anchorScroll, $animate) {
895
863
// function is called before linking the content, which would apply child
896
864
// directives to non existing elements.
897
865
var clone = $transclude ( newScope , function ( clone ) {
898
- $animate . enter ( clone , null , currentElement || $element ) . then ( function onNgViewEnter ( ) {
866
+ $animate . enter ( clone , null , currentElement || $element , function onNgViewEnter ( ) {
899
867
if ( angular . isDefined ( autoScrollExp )
900
868
&& ( ! autoScrollExp || scope . $eval ( autoScrollExp ) ) ) {
901
869
$anchorScroll ( ) ;
0 commit comments