angularjs-rails 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angularjs-rails/version.rb +1 -1
- data/vendor/assets/javascripts/angular-animate.js +91 -34
- data/vendor/assets/javascripts/angular-cookies.js +1 -1
- data/vendor/assets/javascripts/angular-loader.js +8 -3
- data/vendor/assets/javascripts/angular-mocks.js +2 -2
- data/vendor/assets/javascripts/angular-resource.js +3 -3
- data/vendor/assets/javascripts/angular-route.js +40 -27
- data/vendor/assets/javascripts/angular-sanitize.js +1 -1
- data/vendor/assets/javascripts/angular-scenario.js +242 -158
- data/vendor/assets/javascripts/angular-touch.js +1 -1
- data/vendor/assets/javascripts/angular.js +246 -162
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0825fcb1c4da6f3d997bf9bd9c3a3fa143912870
|
4
|
+
data.tar.gz: a58f53f0cc10ab535cd11a55b869dcf7b51fc141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e3b52d663925653eb3790d0c4d3000ebc3a36864a630e78dae28bd7e887c8dae3d488f8c1700d5af2b442706c771caefe204764e43f89c1685c8bfb089aaad0
|
7
|
+
data.tar.gz: be95b1c2ce922824abec3fba7b66919e450b98d9c8e2ffcf917f9574c66e491fb4c8f9c3bec1cb05bf2cee3926679132f0bed34011818a9b300b8efc3653660e
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -165,7 +165,7 @@
|
|
165
165
|
* }
|
166
166
|
* </pre>
|
167
167
|
*
|
168
|
-
* Staggering animations work by default in ngRepeat (so long as the CSS class is
|
168
|
+
* Staggering animations work by default in ngRepeat (so long as the CSS class is defined). Outside of ngRepeat, to use staggering animations
|
169
169
|
* on your own, they can be triggered by firing multiple calls to the same event on $animate. However, the restrictions surrounding this
|
170
170
|
* are that each of the elements must have the same CSS className value as well as the same parent element. A stagger operation
|
171
171
|
* will also be reset if more than 10ms has passed after the last animation has been fired.
|
@@ -228,7 +228,7 @@
|
|
228
228
|
* JavaScript-defined animations are created with a CSS-like class selector and a collection of events which are set to run
|
229
229
|
* a javascript callback function. When an animation is triggered, $animate will look for a matching animation which fits
|
230
230
|
* the element's CSS class attribute value and then run the matching animation event function (if found).
|
231
|
-
* In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function
|
231
|
+
* In other words, if the CSS classes present on the animated element match any of the JavaScript animations then the callback function will
|
232
232
|
* be executed. It should be also noted that only simple, single class selectors are allowed (compound class selectors are not supported).
|
233
233
|
*
|
234
234
|
* Within a JavaScript animation, an object containing various event callback animation functions is expected to be returned.
|
@@ -516,6 +516,7 @@ angular.module('ngAnimate', ['ng'])
|
|
516
516
|
* @function
|
517
517
|
*
|
518
518
|
* @param {boolean=} value If provided then set the animation on or off.
|
519
|
+
* @param {jQuery/jqLite element=} element If provided then the element will be used to represent the enable/disable operation
|
519
520
|
* @return {boolean} Current animation state.
|
520
521
|
*
|
521
522
|
* @description
|
@@ -554,7 +555,8 @@ angular.module('ngAnimate', ['ng'])
|
|
554
555
|
and the onComplete callback will be fired once the animation is fully complete.
|
555
556
|
*/
|
556
557
|
function performAnimation(animationEvent, className, element, parentElement, afterElement, domOperation, doneCallback) {
|
557
|
-
var
|
558
|
+
var currentClassName = element.attr('class') || '';
|
559
|
+
var classes = currentClassName + ' ' + className;
|
558
560
|
var animationLookup = (' ' + classes).replace(/\s+/g,'.');
|
559
561
|
if (!parentElement) {
|
560
562
|
parentElement = afterElement ? afterElement.parent() : element.parent();
|
@@ -569,7 +571,7 @@ angular.module('ngAnimate', ['ng'])
|
|
569
571
|
//the animation if any matching animations are not found at all.
|
570
572
|
//NOTE: IE8 + IE9 should close properly (run closeAnimation()) in case a NO animation is not found.
|
571
573
|
if (animationsDisabled(element, parentElement) || matches.length === 0) {
|
572
|
-
|
574
|
+
fireDOMOperation();
|
573
575
|
closeAnimation();
|
574
576
|
return;
|
575
577
|
}
|
@@ -602,27 +604,48 @@ angular.module('ngAnimate', ['ng'])
|
|
602
604
|
//this would mean that an animation was not allowed so let the existing
|
603
605
|
//animation do it's thing and close this one early
|
604
606
|
if(animations.length === 0) {
|
605
|
-
|
607
|
+
fireDOMOperation();
|
606
608
|
fireDoneCallbackAsync();
|
607
609
|
return;
|
608
610
|
}
|
609
611
|
|
612
|
+
//this value will be searched for class-based CSS className lookup. Therefore,
|
613
|
+
//we prefix and suffix the current className value with spaces to avoid substring
|
614
|
+
//lookups of className tokens
|
615
|
+
var futureClassName = ' ' + currentClassName + ' ';
|
610
616
|
if(ngAnimateState.running) {
|
611
617
|
//if an animation is currently running on the element then lets take the steps
|
612
618
|
//to cancel that animation and fire any required callbacks
|
613
619
|
$timeout.cancel(ngAnimateState.closeAnimationTimeout);
|
614
620
|
cleanup(element);
|
615
621
|
cancelAnimations(ngAnimateState.animations);
|
616
|
-
|
622
|
+
|
623
|
+
//if the class is removed during the reflow then it will revert the styles temporarily
|
624
|
+
//back to the base class CSS styling causing a jump-like effect to occur. This check
|
625
|
+
//here ensures that the domOperation is only performed after the reflow has commenced
|
626
|
+
if(ngAnimateState.beforeComplete) {
|
627
|
+
(ngAnimateState.done || noop)(true);
|
628
|
+
} else if(isClassBased && !ngAnimateState.structural) {
|
629
|
+
//class-based animations will compare element className values after cancelling the
|
630
|
+
//previous animation to see if the element properties already contain the final CSS
|
631
|
+
//class and if so then the animation will be skipped. Since the domOperation will
|
632
|
+
//be performed only after the reflow is complete then our element's className value
|
633
|
+
//will be invalid. Therefore the same string manipulation that would occur within the
|
634
|
+
//DOM operation will be performed below so that the class comparison is valid...
|
635
|
+
futureClassName = ngAnimateState.event == 'removeClass' ?
|
636
|
+
futureClassName.replace(ngAnimateState.className, '') :
|
637
|
+
futureClassName + ngAnimateState.className + ' ';
|
638
|
+
}
|
617
639
|
}
|
618
640
|
|
619
641
|
//There is no point in perform a class-based animation if the element already contains
|
620
642
|
//(on addClass) or doesn't contain (on removeClass) the className being animated.
|
621
643
|
//The reason why this is being called after the previous animations are cancelled
|
622
644
|
//is so that the CSS classes present on the element can be properly examined.
|
623
|
-
|
624
|
-
|
625
|
-
|
645
|
+
var classNameToken = ' ' + className + ' ';
|
646
|
+
if((animationEvent == 'addClass' && futureClassName.indexOf(classNameToken) >= 0) ||
|
647
|
+
(animationEvent == 'removeClass' && futureClassName.indexOf(classNameToken) == -1)) {
|
648
|
+
fireDOMOperation();
|
626
649
|
fireDoneCallbackAsync();
|
627
650
|
return;
|
628
651
|
}
|
@@ -633,6 +656,8 @@ angular.module('ngAnimate', ['ng'])
|
|
633
656
|
|
634
657
|
element.data(NG_ANIMATE_STATE, {
|
635
658
|
running:true,
|
659
|
+
event:animationEvent,
|
660
|
+
className:className,
|
636
661
|
structural:!isClassBased,
|
637
662
|
animations:animations,
|
638
663
|
done:onBeforeAnimationsComplete
|
@@ -643,7 +668,7 @@ angular.module('ngAnimate', ['ng'])
|
|
643
668
|
invokeRegisteredAnimationFns(animations, 'before', onBeforeAnimationsComplete);
|
644
669
|
|
645
670
|
function onBeforeAnimationsComplete(cancelled) {
|
646
|
-
|
671
|
+
fireDOMOperation();
|
647
672
|
if(cancelled === true) {
|
648
673
|
closeAnimation();
|
649
674
|
return;
|
@@ -701,6 +726,15 @@ angular.module('ngAnimate', ['ng'])
|
|
701
726
|
doneCallback && $timeout(doneCallback, 0, false);
|
702
727
|
}
|
703
728
|
|
729
|
+
//it is less complicated to use a flag than managing and cancelling
|
730
|
+
//timeouts containing multiple callbacks.
|
731
|
+
function fireDOMOperation() {
|
732
|
+
if(!fireDOMOperation.hasBeenRun) {
|
733
|
+
fireDOMOperation.hasBeenRun = true;
|
734
|
+
domOperation();
|
735
|
+
}
|
736
|
+
}
|
737
|
+
|
704
738
|
function closeAnimation() {
|
705
739
|
if(!closeAnimation.hasBeenRun) {
|
706
740
|
closeAnimation.hasBeenRun = true;
|
@@ -743,10 +777,10 @@ angular.module('ngAnimate', ['ng'])
|
|
743
777
|
function cancelAnimations(animations) {
|
744
778
|
var isCancelledFlag = true;
|
745
779
|
forEach(animations, function(animation) {
|
746
|
-
if(!animations
|
780
|
+
if(!animations.beforeComplete) {
|
747
781
|
(animation.beforeEnd || noop)(isCancelledFlag);
|
748
782
|
}
|
749
|
-
if(!animations
|
783
|
+
if(!animations.afterComplete) {
|
750
784
|
(animation.afterEnd || noop)(isCancelledFlag);
|
751
785
|
}
|
752
786
|
});
|
@@ -848,13 +882,6 @@ angular.module('ngAnimate', ['ng'])
|
|
848
882
|
}, 10, false);
|
849
883
|
}
|
850
884
|
|
851
|
-
function applyStyle(node, style) {
|
852
|
-
var oldStyle = node.getAttribute('style') || '';
|
853
|
-
var newStyle = (oldStyle.length > 0 ? '; ' : '') + style;
|
854
|
-
node.setAttribute('style', newStyle);
|
855
|
-
return oldStyle;
|
856
|
-
}
|
857
|
-
|
858
885
|
function getElementAnimationDetails(element, cacheKey) {
|
859
886
|
var data = cacheKey ? lookupCache[cacheKey] : null;
|
860
887
|
if(!data) {
|
@@ -973,7 +1000,9 @@ angular.module('ngAnimate', ['ng'])
|
|
973
1000
|
if(timings.transitionDuration > 0) {
|
974
1001
|
element.addClass(NG_ANIMATE_FALLBACK_CLASS_NAME);
|
975
1002
|
activeClassName += NG_ANIMATE_FALLBACK_ACTIVE_CLASS_NAME + ' ';
|
976
|
-
|
1003
|
+
blockTransitions(element);
|
1004
|
+
} else {
|
1005
|
+
blockKeyframeAnimations(element);
|
977
1006
|
}
|
978
1007
|
|
979
1008
|
forEach(className.split(' '), function(klass, i) {
|
@@ -993,6 +1022,25 @@ angular.module('ngAnimate', ['ng'])
|
|
993
1022
|
return true;
|
994
1023
|
}
|
995
1024
|
|
1025
|
+
function blockTransitions(element) {
|
1026
|
+
element[0].style[TRANSITION_PROP + PROPERTY_KEY] = 'none';
|
1027
|
+
}
|
1028
|
+
|
1029
|
+
function blockKeyframeAnimations(element) {
|
1030
|
+
element[0].style[ANIMATION_PROP] = 'none 0s';
|
1031
|
+
}
|
1032
|
+
|
1033
|
+
function unblockTransitions(element) {
|
1034
|
+
var node = element[0], prop = TRANSITION_PROP + PROPERTY_KEY;
|
1035
|
+
if(node.style[prop] && node.style[prop].length > 0) {
|
1036
|
+
node.style[prop] = '';
|
1037
|
+
}
|
1038
|
+
}
|
1039
|
+
|
1040
|
+
function unblockKeyframeAnimations(element) {
|
1041
|
+
element[0].style[ANIMATION_PROP] = '';
|
1042
|
+
}
|
1043
|
+
|
996
1044
|
function animateRun(element, className, activeAnimationComplete) {
|
997
1045
|
var data = element.data(NG_ANIMATE_CSS_DATA_KEY);
|
998
1046
|
if(!element.hasClass(className) || !data) {
|
@@ -1008,20 +1056,21 @@ angular.module('ngAnimate', ['ng'])
|
|
1008
1056
|
var maxDelayTime = Math.max(timings.transitionDelay, timings.animationDelay) * 1000;
|
1009
1057
|
var startTime = Date.now();
|
1010
1058
|
var css3AnimationEvents = ANIMATIONEND_EVENT + ' ' + TRANSITIONEND_EVENT;
|
1011
|
-
var formerStyle;
|
1012
1059
|
var ii = data.ii;
|
1013
1060
|
|
1014
|
-
var applyFallbackStyle, style = '';
|
1061
|
+
var applyFallbackStyle, style = '', appliedStyles = [];
|
1015
1062
|
if(timings.transitionDuration > 0) {
|
1016
|
-
node.style[TRANSITION_PROP + PROPERTY_KEY] = '';
|
1017
|
-
|
1018
1063
|
var propertyStyle = timings.transitionPropertyStyle;
|
1019
1064
|
if(propertyStyle.indexOf('all') == -1) {
|
1020
1065
|
applyFallbackStyle = true;
|
1021
|
-
var fallbackProperty = $sniffer.msie ? '-ms-zoom' : '
|
1066
|
+
var fallbackProperty = $sniffer.msie ? '-ms-zoom' : 'border-spacing';
|
1022
1067
|
style += CSS_PREFIX + 'transition-property: ' + propertyStyle + ', ' + fallbackProperty + '; ';
|
1023
1068
|
style += CSS_PREFIX + 'transition-duration: ' + timings.transitionDurationStyle + ', ' + timings.transitionDuration + 's; ';
|
1069
|
+
appliedStyles.push(CSS_PREFIX + 'transition-property');
|
1070
|
+
appliedStyles.push(CSS_PREFIX + 'transition-duration');
|
1024
1071
|
}
|
1072
|
+
} else {
|
1073
|
+
unblockKeyframeAnimations(element);
|
1025
1074
|
}
|
1026
1075
|
|
1027
1076
|
if(ii > 0) {
|
@@ -1033,16 +1082,19 @@ angular.module('ngAnimate', ['ng'])
|
|
1033
1082
|
|
1034
1083
|
style += CSS_PREFIX + 'transition-delay: ' +
|
1035
1084
|
prepareStaggerDelay(delayStyle, stagger.transitionDelay, ii) + '; ';
|
1085
|
+
appliedStyles.push(CSS_PREFIX + 'transition-delay');
|
1036
1086
|
}
|
1037
1087
|
|
1038
1088
|
if(stagger.animationDelay > 0 && stagger.animationDuration === 0) {
|
1039
1089
|
style += CSS_PREFIX + 'animation-delay: ' +
|
1040
1090
|
prepareStaggerDelay(timings.animationDelayStyle, stagger.animationDelay, ii) + '; ';
|
1091
|
+
appliedStyles.push(CSS_PREFIX + 'animation-delay');
|
1041
1092
|
}
|
1042
1093
|
}
|
1043
1094
|
|
1044
|
-
if(
|
1045
|
-
|
1095
|
+
if(appliedStyles.length > 0) {
|
1096
|
+
var oldStyle = node.getAttribute('style') || '';
|
1097
|
+
node.setAttribute('style', oldStyle + ' ' + style);
|
1046
1098
|
}
|
1047
1099
|
|
1048
1100
|
element.on(css3AnimationEvents, onAnimationProgress);
|
@@ -1055,10 +1107,8 @@ angular.module('ngAnimate', ['ng'])
|
|
1055
1107
|
element.off(css3AnimationEvents, onAnimationProgress);
|
1056
1108
|
element.removeClass(activeClassName);
|
1057
1109
|
animateClose(element, className);
|
1058
|
-
|
1059
|
-
|
1060
|
-
node.setAttribute('style', formerStyle) :
|
1061
|
-
node.removeAttribute('style');
|
1110
|
+
for (var i in appliedStyles) {
|
1111
|
+
node.style.removeProperty(appliedStyles[i]);
|
1062
1112
|
}
|
1063
1113
|
};
|
1064
1114
|
|
@@ -1122,6 +1172,7 @@ angular.module('ngAnimate', ['ng'])
|
|
1122
1172
|
//happen in the first place
|
1123
1173
|
var cancel = preReflowCancellation;
|
1124
1174
|
afterReflow(function() {
|
1175
|
+
unblockTransitions(element);
|
1125
1176
|
//once the reflow is complete then we point cancel to
|
1126
1177
|
//the new cancellation function which will remove all of the
|
1127
1178
|
//animation properties from the active animation
|
@@ -1185,7 +1236,10 @@ angular.module('ngAnimate', ['ng'])
|
|
1185
1236
|
beforeAddClass : function(element, className, animationCompleted) {
|
1186
1237
|
var cancellationMethod = animateBefore(element, suffixClasses(className, '-add'));
|
1187
1238
|
if(cancellationMethod) {
|
1188
|
-
afterReflow(
|
1239
|
+
afterReflow(function() {
|
1240
|
+
unblockTransitions(element);
|
1241
|
+
animationCompleted();
|
1242
|
+
});
|
1189
1243
|
return cancellationMethod;
|
1190
1244
|
}
|
1191
1245
|
animationCompleted();
|
@@ -1198,7 +1252,10 @@ angular.module('ngAnimate', ['ng'])
|
|
1198
1252
|
beforeRemoveClass : function(element, className, animationCompleted) {
|
1199
1253
|
var cancellationMethod = animateBefore(element, suffixClasses(className, '-remove'));
|
1200
1254
|
if(cancellationMethod) {
|
1201
|
-
afterReflow(
|
1255
|
+
afterReflow(function() {
|
1256
|
+
unblockTransitions(element);
|
1257
|
+
animationCompleted();
|
1258
|
+
});
|
1202
1259
|
return cancellationMethod;
|
1203
1260
|
}
|
1204
1261
|
animationCompleted();
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -69,7 +69,7 @@ function minErr(module) {
|
|
69
69
|
return match;
|
70
70
|
});
|
71
71
|
|
72
|
-
message = message + '\nhttp://errors.angularjs.org/1.2.
|
72
|
+
message = message + '\nhttp://errors.angularjs.org/1.2.2/' +
|
73
73
|
(module ? module + '/' : '') + code;
|
74
74
|
for (i = 2; i < arguments.length; i++) {
|
75
75
|
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
|
@@ -97,7 +97,12 @@ function setupModuleLoader(window) {
|
|
97
97
|
return obj[name] || (obj[name] = factory());
|
98
98
|
}
|
99
99
|
|
100
|
-
|
100
|
+
var angular = ensure(window, 'angular', Object);
|
101
|
+
|
102
|
+
// We need to expose `angular.$$minErr` to modules such as `ngResource` that reference it during bootstrap
|
103
|
+
angular.$$minErr = angular.$$minErr || minErr;
|
104
|
+
|
105
|
+
return ensure(angular, 'module', function() {
|
101
106
|
/** @type {Object.<string, angular.Module>} */
|
102
107
|
var modules = {};
|
103
108
|
|
@@ -1,7 +1,7 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
3
|
/**
|
4
|
-
* @license AngularJS v1.2.
|
4
|
+
* @license AngularJS v1.2.2
|
5
5
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
6
6
|
* License: MIT
|
7
7
|
*
|
@@ -1572,7 +1572,7 @@ function MockHttpExpectation(method, url, data, headers) {
|
|
1572
1572
|
if (angular.isUndefined(data)) return true;
|
1573
1573
|
if (data && angular.isFunction(data.test)) return data.test(d);
|
1574
1574
|
if (data && angular.isFunction(data)) return data(d);
|
1575
|
-
if (data && !angular.isString(data)) return angular.
|
1575
|
+
if (data && !angular.isString(data)) return angular.equals(data, angular.fromJson(d));
|
1576
1576
|
return data == d;
|
1577
1577
|
};
|
1578
1578
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -444,7 +444,7 @@ angular.module('ngResource', ['ng']).
|
|
444
444
|
}
|
445
445
|
/* jshint +W086 */ /* (purposefully fall through case statements) */
|
446
446
|
|
447
|
-
var isInstanceCall =
|
447
|
+
var isInstanceCall = this instanceof Resource;
|
448
448
|
var value = isInstanceCall ? data : (action.isArray ? [] : new Resource(data));
|
449
449
|
var httpConfig = {};
|
450
450
|
var responseInterceptor = action.interceptor && action.interceptor.response ||
|
@@ -527,7 +527,7 @@ angular.module('ngResource', ['ng']).
|
|
527
527
|
if (isFunction(params)) {
|
528
528
|
error = success; success = params; params = {};
|
529
529
|
}
|
530
|
-
var result = Resource[name](params, this, success, error);
|
530
|
+
var result = Resource[name].call(this, params, this, success, error);
|
531
531
|
return result.$promise || result;
|
532
532
|
};
|
533
533
|
});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/**
|
2
|
-
* @license AngularJS v1.2.
|
2
|
+
* @license AngularJS v1.2.2
|
3
3
|
* (c) 2010-2012 Google, Inc. http://angularjs.org
|
4
4
|
* License: MIT
|
5
5
|
*/
|
@@ -14,6 +14,9 @@
|
|
14
14
|
*
|
15
15
|
* The `ngRoute` module provides routing and deeplinking services and directives for angular apps.
|
16
16
|
*
|
17
|
+
* ## Example
|
18
|
+
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
|
19
|
+
*
|
17
20
|
* {@installModule route}
|
18
21
|
*
|
19
22
|
* <div doc-module-components="ngRoute"></div>
|
@@ -29,8 +32,12 @@ var ngRouteModule = angular.module('ngRoute', ['ng']).
|
|
29
32
|
*
|
30
33
|
* @description
|
31
34
|
*
|
32
|
-
* Used for configuring routes.
|
35
|
+
* Used for configuring routes.
|
36
|
+
*
|
37
|
+
* ## Example
|
38
|
+
* See {@link ngRoute.$route#example $route} for an example of configuring and using `ngRoute`.
|
33
39
|
*
|
40
|
+
* ## Dependencies
|
34
41
|
* Requires the {@link ngRoute `ngRoute`} module to be installed.
|
35
42
|
*/
|
36
43
|
function $RouteProvider(){
|
@@ -835,37 +842,43 @@ function ngViewFactory( $route, $anchorScroll, $compile, $controller,
|
|
835
842
|
|
836
843
|
if (template) {
|
837
844
|
var newScope = scope.$new();
|
838
|
-
$transclude(newScope, function(clone) {
|
839
|
-
clone.html(template);
|
840
|
-
$animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
|
841
|
-
if (angular.isDefined(autoScrollExp)
|
842
|
-
&& (!autoScrollExp || scope.$eval(autoScrollExp))) {
|
843
|
-
$anchorScroll();
|
844
|
-
}
|
845
|
-
});
|
846
845
|
|
847
|
-
|
846
|
+
// Note: This will also link all children of ng-view that were contained in the original
|
847
|
+
// html. If that content contains controllers, ... they could pollute/change the scope.
|
848
|
+
// However, using ng-view on an element with additional content does not make sense...
|
849
|
+
// Note: We can't remove them in the cloneAttchFn of $transclude as that
|
850
|
+
// function is called before linking the content, which would apply child
|
851
|
+
// directives to non existing elements.
|
852
|
+
var clone = $transclude(newScope, angular.noop);
|
853
|
+
clone.html(template);
|
854
|
+
$animate.enter(clone, null, currentElement || $element, function onNgViewEnter () {
|
855
|
+
if (angular.isDefined(autoScrollExp)
|
856
|
+
&& (!autoScrollExp || scope.$eval(autoScrollExp))) {
|
857
|
+
$anchorScroll();
|
858
|
+
}
|
859
|
+
});
|
848
860
|
|
849
|
-
|
850
|
-
current = $route.current;
|
861
|
+
cleanupLastView();
|
851
862
|
|
852
|
-
|
853
|
-
|
863
|
+
var link = $compile(clone.contents()),
|
864
|
+
current = $route.current;
|
854
865
|
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
866
|
+
currentScope = current.scope = newScope;
|
867
|
+
currentElement = clone;
|
868
|
+
|
869
|
+
if (current.controller) {
|
870
|
+
locals.$scope = currentScope;
|
871
|
+
var controller = $controller(current.controller, locals);
|
872
|
+
if (current.controllerAs) {
|
873
|
+
currentScope[current.controllerAs] = controller;
|
863
874
|
}
|
875
|
+
clone.data('$ngControllerController', controller);
|
876
|
+
clone.children().data('$ngControllerController', controller);
|
877
|
+
}
|
864
878
|
|
865
|
-
|
866
|
-
|
867
|
-
|
868
|
-
});
|
879
|
+
link(currentScope);
|
880
|
+
currentScope.$emit('$viewContentLoaded');
|
881
|
+
currentScope.$eval(onloadExp);
|
869
882
|
} else {
|
870
883
|
cleanupLastView();
|
871
884
|
}
|