Update Angular to 1.2.0 RC2

This commit is contained in:
Colin Frei 2013-09-22 11:10:37 +02:00
parent 7416269494
commit 0d3a40980e
184 changed files with 17993 additions and 21133 deletions

View file

@ -9472,7 +9472,7 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
})( window );
/**
* @license AngularJS v1.2.0rc1
* @license AngularJS v1.2.0-rc.2
* (c) 2010-2012 Google, Inc. http://angularjs.org
* License: MIT
*/
@ -9509,10 +9509,21 @@ if ( typeof define === "function" && define.amd && define.amd.jQuery ) {
function minErr(module) {
return function () {
var prefix = '[' + (module ? module + ':' : '') + arguments[0] + '] ',
var code = arguments[0],
prefix = '[' + (module ? module + ':' : '') + code + '] ',
template = arguments[1],
templateArgs = arguments,
message;
stringify = function (obj) {
if (isFunction(obj)) {
return obj.toString().replace(/ \{[\s\S]*$/, '');
} else if (isUndefined(obj)) {
return 'undefined';
} else if (!isString(obj)) {
return JSON.stringify(obj);
}
return obj;
},
message, i;
message = prefix + template.replace(/\{\d+\}/g, function (match) {
var index = +match.slice(1, -1), arg;
@ -9531,6 +9542,13 @@ function minErr(module) {
return match;
});
message = message + '\nhttp://errors.angularjs.org/' + version.full + '/' +
(module ? module + '/' : '') + code;
for (i = 2; i < arguments.length; i++) {
message = message + (i == 2 ? '?' : '&') + 'p' + (i-2) + '=' +
encodeURIComponent(stringify(arguments[i]));
}
return new Error(message);
};
}
@ -9593,7 +9611,7 @@ if ('i' !== 'I'.toLowerCase()) {
var /** holds major version number for IE or NaN for real browsers */
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]),
msie,
jqLite, // delay binding since jQuery could be loaded after us.
jQuery, // delay binding
slice = [].slice,
@ -9609,6 +9627,16 @@ var /** holds major version number for IE or NaN for real browsers */
nodeName_,
uid = ['0', '0', '0'];
/**
* IE 11 changed the format of the UserAgent string.
* See http://msdn.microsoft.com/en-us/library/ms537503.aspx
*/
msie = int((/msie (\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);
if (isNaN(msie)) {
msie = int((/trident\/.*; rv:(\d+)/.exec(lowercase(navigator.userAgent)) || [])[1]);
}
/**
* @private
* @param {*} obj
@ -10723,10 +10751,13 @@ function setupModuleLoader(window) {
* @name angular.module
* @description
*
* The `angular.module` is a global place for creating and registering Angular modules. All
* modules (angular core or 3rd party) that should be available to an application must be
* The `angular.module` is a global place for creating, registering and retrieving Angular modules.
* All modules (angular core or 3rd party) that should be available to an application must be
* registered using this mechanism.
*
* When passed two or more arguments, a new module is created. If passed only one argument, an
* existing module (the name passed as the first argument to `module`) is retrieved.
*
*
* # Module
*
@ -10997,11 +11028,11 @@ function setupModuleLoader(window) {
* - `codeName` `{string}` Code name of the release, such as "jiggling-armfat".
*/
var version = {
full: '1.2.0rc1', // all of these placeholder strings will be replaced by grunt's
full: '1.2.0-rc.2', // all of these placeholder strings will be replaced by grunt's
major: 1, // package task
minor: 2,
dot: 0,
codeName: 'spooky-giraffe'
codeName: 'barehand-atomsplitting'
};
@ -12064,13 +12095,15 @@ function annotate(fn) {
if (typeof fn == 'function') {
if (!($inject = fn.$inject)) {
$inject = [];
fnText = fn.toString().replace(STRIP_COMMENTS, '');
argDecl = fnText.match(FN_ARGS);
forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
arg.replace(FN_ARG, function(all, underscore, name){
$inject.push(name);
if (fn.length) {
fnText = fn.toString().replace(STRIP_COMMENTS, '');
argDecl = fnText.match(FN_ARGS);
forEach(argDecl[1].split(FN_ARG_SPLIT), function(arg){
arg.replace(FN_ARG, function(all, underscore, name){
$inject.push(name);
});
});
});
}
fn.$inject = $inject;
}
} else if (isArray(fn)) {
@ -12794,7 +12827,7 @@ var $AnimateProvider = ['$provide', function($provide) {
forEach(element, function(node) {
parentNode.insertBefore(node, afterNextSibling);
});
$timeout(done || noop, 0, false);
done && $timeout(done, 0, false);
},
/**
@ -12811,7 +12844,7 @@ var $AnimateProvider = ['$provide', function($provide) {
*/
leave : function(element, done) {
element.remove();
$timeout(done || noop, 0, false);
done && $timeout(done, 0, false);
},
/**
@ -12853,7 +12886,7 @@ var $AnimateProvider = ['$provide', function($provide) {
className :
isArray(className) ? className.join(' ') : '';
element.addClass(className);
$timeout(done || noop, 0, false);
done && $timeout(done, 0, false);
},
/**
@ -12874,7 +12907,7 @@ var $AnimateProvider = ['$provide', function($provide) {
className :
isArray(className) ? className.join(' ') : '';
element.removeClass(className);
$timeout(done || noop, 0, false);
done && $timeout(done, 0, false);
},
enabled : noop
@ -15173,7 +15206,7 @@ function $HttpProvider() {
// strip json vulnerability protection prefix
data = data.replace(PROTECTION_PREFIX, '');
if (JSON_START.test(data) && JSON_END.test(data))
data = fromJson(data, true);
data = fromJson(data);
}
return data;
}],
@ -15489,6 +15522,7 @@ function $HttpProvider() {
* return function(promise) {
* return promise.then(function(response) {
* // do something on success
* return response;
* }, function(response) {
* // do something on error
* if (canRecover(response)) {
@ -15968,7 +16002,7 @@ function $HttpProvider() {
if (cache) {
cachedResp = cache.get(url);
if (cachedResp) {
if (isDefined(cachedResp)) {
if (cachedResp.then) {
// cached request has already been sent, but there is no response yet
cachedResp.then(removePendingReq, removePendingReq);
@ -15988,7 +16022,7 @@ function $HttpProvider() {
}
// if we won't have the response in cache, send the request to the backend
if (!cachedResp) {
if (isUndefined(cachedResp)) {
$httpBackend(config.method, url, reqData, done, reqHeaders, config.timeout,
config.withCredentials, config.responseType);
}
@ -16238,23 +16272,32 @@ var $interpolateMinErr = minErr('$interpolate');
* @description
*
* Used for configuring the interpolation markup. Defaults to `{{` and `}}`.
*
*
* @example
<doc:example>
<doc:example module="customInterpolationApp">
<doc:source>
<script>
var myApp = angular.module('App', [], function($interpolateProvider) {
var customInterpolationApp = angular.module('customInterpolationApp', []);
customInterpolationApp.config(function($interpolateProvider) {
$interpolateProvider.startSymbol('//');
$interpolateProvider.endSymbol('//');
});
function Controller($scope) {
$scope.label = "Interpolation Provider Sample";
}
customInterpolationApp.controller('DemoController', function DemoController() {
this.label = "This bindings is brought you you by // interpolation symbols.";
});
</script>
<div ng-app="App" ng-controller="Controller">
//label//
<div ng-app="App" ng-controller="DemoController as demo">
//demo.label//
</div>
</doc:source>
<doc:scenario>
it('should interpolate binding with custom symbols', function() {
expect(binding('demo.label')).toBe('This bindings is brought you you by // interpolation symbols.');
});
</doc:scenario>
</doc:example>
*/
function $InterpolateProvider() {
@ -17318,7 +17361,6 @@ var $parseMinErr = minErr('$parse');
// access to any member named "constructor".
//
// For reflective calls (a[b]) we check that the value of the lookup is not the Function constructor while evaluating
// For reflective calls (a[b]) we check that the value of the lookup is not the Function constructor while evaluating
// the expression, which is a stronger but more expensive test. Since reflective calls are expensive anyway, this is not
// such a big deal compared to static dereferencing.
//
@ -17992,9 +18034,21 @@ function parser(text, json, $filter, csp){
}
var fnPtr = fn(scope, locals, context) || noop;
// IE stupidity!
return fnPtr.apply
var v = fnPtr.apply
? fnPtr.apply(context, args)
: fnPtr(args[0], args[1], args[2], args[3], args[4]);
// Check for promise
if (v && v.then) {
var p = v;
if (!('$$v' in v)) {
p.$$v = undefined;
p.then(function(val) { p.$$v = val; });
}
v = v.$$v;
}
return v;
};
}
@ -18298,6 +18352,8 @@ function $ParseProvider() {
* // since this fn executes async in a future turn of the event loop, we need to wrap
* // our code into an $apply call so that the model changes are properly observed.
* scope.$apply(function() {
* deferred.notify('About to greet ' + name + '.');
*
* if (okToGreet(name)) {
* deferred.resolve('Hello, ' + name + '!');
* } else {
@ -18314,6 +18370,8 @@ function $ParseProvider() {
* alert('Success: ' + greeting);
* }, function(reason) {
* alert('Failed: ' + reason);
* }, function(update) {
* alert('Got notification: ' + update);
* });
* </pre>
*
@ -18332,7 +18390,8 @@ function $ParseProvider() {
* A new instance of deferred is constructed by calling `$q.defer()`.
*
* The purpose of the deferred object is to expose the associated Promise instance as well as APIs
* that can be used for signaling the successful or unsuccessful completion of the task.
* that can be used for signaling the successful or unsuccessful completion, as well as the status
* of the task.
*
* **Methods**
*
@ -18340,6 +18399,8 @@ function $ParseProvider() {
* constructed via `$q.reject`, the promise will be rejected instead.
* - `reject(reason)` rejects the derived promise with the `reason`. This is equivalent to
* resolving it with a rejection constructed via `$q.reject`.
* - `notify(value)` - provides updates on the status of the promises execution. This may be called
* multiple times before the promise is either resolved or rejected.
*
* **Properties**
*
@ -18356,12 +18417,15 @@ function $ParseProvider() {
*
* **Methods**
*
* - `then(successCallback, errorCallback)` regardless of when the promise was or will be resolved
* or rejected, `then` calls one of the success or error callbacks asynchronously as soon as the result
* is available. The callbacks are called with a single argument: the result or rejection reason.
* - `then(successCallback, errorCallback, notifyCallback)` regardless of when the promise was or
* will be resolved or rejected, `then` calls one of the success or error callbacks asynchronously
* as soon as the result is available. The callbacks are called with a single argument: the result
* or rejection reason. Additionally, the notify callback may be called zero or more times to
* provide a progress indication, before the promise is resolved or rejected.
*
* This method *returns a new promise* which is resolved or rejected via the return value of the
* `successCallback` or `errorCallback`.
* `successCallback`, `errorCallback`. It also notifies via the return value of the `notifyCallback`
* method. The promise can not be resolved or rejected from the notifyCallback method.
*
* - `catch(errorCallback)` shorthand for `promise.then(null, errorCallback)`
*
@ -18513,7 +18577,7 @@ function qFactory(nextTick, exceptionHandler) {
var wrappedCallback = function(value) {
try {
result.resolve((callback || defaultCallback)(value));
result.resolve((isFunction(callback) ? callback : defaultCallback)(value));
} catch(e) {
result.reject(e);
exceptionHandler(e);
@ -18522,7 +18586,7 @@ function qFactory(nextTick, exceptionHandler) {
var wrappedErrback = function(reason) {
try {
result.resolve((errback || defaultErrback)(reason));
result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
} catch(e) {
result.reject(e);
exceptionHandler(e);
@ -18531,7 +18595,7 @@ function qFactory(nextTick, exceptionHandler) {
var wrappedProgressback = function(progress) {
try {
result.notify((progressback || defaultCallback)(progress));
result.notify((isFunction(progressback) ? progressback : defaultCallback)(progress));
} catch(e) {
exceptionHandler(e);
}
@ -18569,7 +18633,7 @@ function qFactory(nextTick, exceptionHandler) {
} catch(e) {
return makePromise(e, false);
}
if (callbackOutput && callbackOutput.then) {
if (callbackOutput && isFunction(callbackOutput.then)) {
return callbackOutput.then(function() {
return makePromise(value, isResolved);
}, function(error) {
@ -18594,7 +18658,7 @@ function qFactory(nextTick, exceptionHandler) {
var ref = function(value) {
if (value && value.then) return value;
if (value && isFunction(value.then)) return value;
return {
then: function(callback) {
var result = defer();
@ -18647,7 +18711,12 @@ function qFactory(nextTick, exceptionHandler) {
then: function(callback, errback) {
var result = defer();
nextTick(function() {
result.resolve((errback || defaultErrback)(reason));
try {
result.resolve((isFunction(errback) ? errback : defaultErrback)(reason));
} catch(e) {
result.reject(e);
exceptionHandler(e);
}
});
return result.promise;
}
@ -18673,7 +18742,7 @@ function qFactory(nextTick, exceptionHandler) {
var wrappedCallback = function(value) {
try {
return (callback || defaultCallback)(value);
return (isFunction(callback) ? callback : defaultCallback)(value);
} catch (e) {
exceptionHandler(e);
return reject(e);
@ -18682,7 +18751,7 @@ function qFactory(nextTick, exceptionHandler) {
var wrappedErrback = function(reason) {
try {
return (errback || defaultErrback)(reason);
return (isFunction(errback) ? errback : defaultErrback)(reason);
} catch (e) {
exceptionHandler(e);
return reject(e);
@ -18691,7 +18760,7 @@ function qFactory(nextTick, exceptionHandler) {
var wrappedProgressback = function(progress) {
try {
return (progressback || defaultCallback)(progress);
return (isFunction(progressback) ? progressback : defaultCallback)(progress);
} catch (e) {
exceptionHandler(e);
}
@ -18841,8 +18910,8 @@ function $RootScopeProvider(){
return TTL;
};
this.$get = ['$injector', '$exceptionHandler', '$parse',
function( $injector, $exceptionHandler, $parse) {
this.$get = ['$injector', '$exceptionHandler', '$parse', '$browser',
function( $injector, $exceptionHandler, $parse, $browser) {
/**
* @ngdoc function
@ -18891,6 +18960,7 @@ function $RootScopeProvider(){
this['this'] = this.$root = this;
this.$$destroyed = false;
this.$$asyncQueue = [];
this.$$postDigestQueue = [];
this.$$listeners = {};
this.$$isolateBindings = {};
}
@ -18905,6 +18975,7 @@ function $RootScopeProvider(){
Scope.prototype = {
constructor: Scope,
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$new
@ -18939,6 +19010,7 @@ function $RootScopeProvider(){
child.$root = this.$root;
// ensure that there is just one async queue per $rootScope and it's children
child.$$asyncQueue = this.$$asyncQueue;
child.$$postDigestQueue = this.$$postDigestQueue;
} else {
Child = function() {}; // should be anonymous; This is so that when the minifier munges
// the name it does not become random set of chars. These will then show up as class
@ -19266,6 +19338,7 @@ function $RootScopeProvider(){
var watch, value, last,
watchers,
asyncQueue = this.$$asyncQueue,
postDigestQueue = this.$$postDigestQueue,
length,
dirty, ttl = TTL,
next, current, target = this,
@ -19338,6 +19411,14 @@ function $RootScopeProvider(){
} while (dirty || asyncQueue.length);
clearPhase();
while(postDigestQueue.length) {
try {
postDigestQueue.shift()();
} catch (e) {
$exceptionHandler(e);
}
}
},
@ -19438,13 +19519,16 @@ function $RootScopeProvider(){
*
* The `$evalAsync` makes no guarantees as to when the `expression` will be executed, only that:
*
* - it will execute in the current script execution context (before any DOM rendering).
* - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after
* `expression` execution.
* - it will execute after the function that schedule the evaluation is done running (preferably before DOM rendering).
* - at least one {@link ng.$rootScope.Scope#$digest $digest cycle} will be performed after `expression` execution.
*
* Any exceptions from the execution of the expression are forwarded to the
* {@link ng.$exceptionHandler $exceptionHandler} service.
*
* __Note:__ if this function is called outside of `$digest` cycle, a new $digest cycle will be scheduled.
* It is however encouraged to always call code that changes the model from withing an `$apply` call.
* That includes code evaluated via `$evalAsync`.
*
* @param {(string|function())=} expression An angular expression to be executed.
*
* - `string`: execute using the rules as defined in {@link guide/expression expression}.
@ -19452,9 +19536,23 @@ function $RootScopeProvider(){
*
*/
$evalAsync: function(expr) {
// if we are outside of an $digest loop and this is the first time we are scheduling async task also schedule
// async auto-flush
if (!$rootScope.$$phase && !$rootScope.$$asyncQueue.length) {
$browser.defer(function() {
if ($rootScope.$$asyncQueue.length) {
$rootScope.$digest();
}
});
}
this.$$asyncQueue.push(expr);
},
$$postDigest : function(expr) {
this.$$postDigestQueue.push(expr);
},
/**
* @ngdoc function
* @name ng.$rootScope.Scope#$apply
@ -20123,7 +20221,7 @@ function $SceDelegateProvider() {
* {@link ng.$sce#getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
*
* As an example, {@link ng.directive:ngBindHtml ngBindHtml} uses {@link
* ng.$sce#parseHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
* ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
* simplified):
*
* <pre class="prettyprint">
@ -20181,7 +20279,7 @@ function $SceDelegateProvider() {
* ## What trusted context types are supported?<a name="contexts"></a>
*
* | Context | Notes |
* |=====================|================|
* |---------------------|----------------|
* | `$sce.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. |
* | `$sce.CSS` | For CSS that's safe to source into the application. Currently unused. Feel free to use it in your own directives. |
* | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (`<a href=` and `<img src=` sanitize their urls and don't consititute an SCE context. |
@ -20692,6 +20790,7 @@ function $SnifferProvider() {
this.$get = ['$window', '$document', function($window, $document) {
var eventSupport = {},
android = int((/android (\d+)/.exec(lowercase(($window.navigator || {}).userAgent)) || [])[1]),
boxee = /Boxee/i.test(($window.navigator || {}).userAgent),
document = $document[0] || {},
vendorPrefix,
vendorRegex = /^(Moz|webkit|O|ms)(?=[A-Z])/,
@ -20708,12 +20807,17 @@ function $SnifferProvider() {
break;
}
}
if(!vendorPrefix) {
vendorPrefix = ('WebkitOpacity' in bodyStyle) && 'webkit';
}
transitions = !!(('transition' in bodyStyle) || (vendorPrefix + 'Transition' in bodyStyle));
animations = !!(('animation' in bodyStyle) || (vendorPrefix + 'Animation' in bodyStyle));
if (android && (!transitions||!animations)) {
transitions = isString(document.body.style.webkitTransition);
animations = isString(document.body.style.webkitAnimation);
transitions = isString(document.body.style.webkitTransition);
animations = isString(document.body.style.webkitAnimation);
}
}
@ -20723,7 +20827,10 @@ function $SnifferProvider() {
// so let's not use the history API at all.
// http://code.google.com/p/android/issues/detail?id=17471
// https://github.com/angular/angular.js/issues/904
history: !!($window.history && $window.history.pushState && !(android < 4)),
// older webit browser (533.9) on Boxee box has exactly the same problem as Android has
// so let's not use the history API also
history: !!($window.history && $window.history.pushState && !(android < 4) && !boxee),
hashchange: 'onhashchange' in $window &&
// IE8 compatible mode lies
(!document.documentMode || document.documentMode > 7),
@ -20783,7 +20890,7 @@ function $TimeoutProvider() {
var deferred = $q.defer(),
promise = deferred.promise,
skipApply = (isDefined(invokeApply) && !invokeApply),
timeoutId, cleanup;
timeoutId;
timeoutId = $browser.defer(function() {
try {
@ -20792,17 +20899,15 @@ function $TimeoutProvider() {
deferred.reject(e);
$exceptionHandler(e);
}
finally {
delete deferreds[promise.$$timeoutId];
}
if (!skipApply) $rootScope.$apply();
}, delay);
cleanup = function() {
delete deferreds[promise.$$timeoutId];
};
promise.$$timeoutId = timeoutId;
deferreds[timeoutId] = deferred;
promise.then(cleanup, cleanup);
return promise;
}
@ -20824,6 +20929,7 @@ function $TimeoutProvider() {
timeout.cancel = function(promise) {
if (promise && promise.$$timeoutId in deferreds) {
deferreds[promise.$$timeoutId].reject('canceled');
delete deferreds[promise.$$timeoutId];
return $browser.defer.cancel(promise.$$timeoutId);
}
return false;
@ -20891,7 +20997,7 @@ function $$UrlUtilsProvider() {
* Otherwise, returns an object with the following members.
*
* | member name | Description |
* |===============|================|
* |---------------|----------------|
* | href | A normalized version of the provided URL if it was not an absolute URL |
* | protocol | The protocol including the trailing colon |
* | host | The host and port (if the port is non-default) of the normalizedUrl |
@ -20899,7 +21005,7 @@ function $$UrlUtilsProvider() {
* These fields from the UrlUtils interface are currently not needed and hence not returned.
*
* | member name | Description |
* |===============|================|
* |---------------|----------------|
* | hostname | The host without the port of the normalizedUrl |
* | pathname | The path following the host in the normalizedUrl |
* | hash | The URL hash if present |
@ -20908,7 +21014,7 @@ function $$UrlUtilsProvider() {
*/
function resolve(url, parse) {
var href = url;
if (msie) {
if (msie <= 11) {
// Normalize before parse. Refer Implementation Notes on why this is
// done in two steps on IE.
urlParsingNode.setAttribute("href", href);
@ -21278,7 +21384,7 @@ function filterFilter() {
})();
} else {
(function() {
if (!expression[key]) return;
if (typeof(expression[key]) == 'undefined') { return; }
var path = key;
predicates.push(function(value) {
return search(getter(value,path), expression[path]);
@ -22007,8 +22113,10 @@ function orderByFilter($parse){
var t1 = typeof v1;
var t2 = typeof v2;
if (t1 == t2) {
if (t1 == "string") v1 = v1.toLowerCase();
if (t1 == "string") v2 = v2.toLowerCase();
if (t1 == "string") {
v1 = v1.toLowerCase();
v2 = v2.toLowerCase();
}
if (v1 === v2) return 0;
return v1 < v2 ? -1 : 1;
} else {
@ -24253,8 +24361,8 @@ var ngBindTemplateDirective = ['$interpolate', function($interpolate) {
var ngBindHtmlDirective = ['$sce', function($sce) {
return function(scope, element, attr) {
element.addClass('ng-binding').data('$binding', attr.ngBindHtml);
scope.$watch($sce.parseAsHtml(attr.ngBindHtml), function ngBindHtmlWatchAction(value) {
element.html(value || '');
scope.$watch(attr.ngBindHtml, function ngBindHtmlWatchAction(value) {
element.html($sce.getTrustedHtml(value) || '');
});
};
}];
@ -24410,7 +24518,7 @@ function classDirective(name, selector) {
## Animations
Example that demostrates how addition and removal of classes can be animated.
The example below demonstrates how to perform animations using ngClass.
<example animations="true">
<file name="index.html">
@ -24455,6 +24563,14 @@ function classDirective(name, selector) {
});
</file>
</example>
## ngClass and pre-existing CSS3 Transitions/Animations
The ngClass directive still supports CSS3 Transitions/Animations even if they do not follow the ngAnimate CSS naming structure.
Therefore, if any CSS3 Transition/Animation styles (outside of ngAnimate) are set on the element, then, if a ngClass animation
is triggered, the ngClass animation will be skipped so that ngAnimate can allow for the pre-existing transition or animation to
take over. This restriction allows for ngClass to still work with standard CSS3 Transitions/Animations that are defined
outside of ngAnimate.
*/
var ngClassDirective = classDirective('', true);
@ -25373,23 +25489,18 @@ var ngIfDirective = ['$animate', function($animate) {
* @description
* Emitted every time the ngInclude content is reloaded.
*/
var NG_INCLUDE_PRIORITY = 500;
var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile', '$animate', '$sce',
function($http, $templateCache, $anchorScroll, $compile, $animate, $sce) {
return {
restrict: 'ECA',
terminal: true,
priority: NG_INCLUDE_PRIORITY,
compile: function(element, attr) {
transclude: 'element',
compile: function(element, attr, transclusion) {
var srcExp = attr.ngInclude || attr.src,
onloadExp = attr.onload || '',
autoScrollExp = attr.autoscroll;
element.html('');
var anchor = jqLite(document.createComment(' ngInclude: ' + srcExp + ' '));
element.replaceWith(anchor);
return function(scope) {
return function(scope, $element) {
var changeCounter = 0,
currentScope,
currentElement;
@ -25413,21 +25524,23 @@ var ngIncludeDirective = ['$http', '$templateCache', '$anchorScroll', '$compile'
if (thisChangeId !== changeCounter) return;
var newScope = scope.$new();
cleanupLastIncludeContent();
transclusion(newScope, function(clone) {
cleanupLastIncludeContent();
currentScope = newScope;
currentElement = element.clone();
currentElement.html(response);
$animate.enter(currentElement, null, anchor);
currentScope = newScope;
currentElement = clone;
$compile(currentElement, false, NG_INCLUDE_PRIORITY - 1)(currentScope);
currentElement.html(response);
$animate.enter(currentElement, null, $element);
$compile(currentElement.contents())(currentScope);
if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
$anchorScroll();
}
if (isDefined(autoScrollExp) && (!autoScrollExp || scope.$eval(autoScrollExp))) {
$anchorScroll();
}
currentScope.$emit('$includeContentLoaded');
scope.$eval(onloadExp);
currentScope.$emit('$includeContentLoaded');
scope.$eval(onloadExp);
});
}).error(function() {
if (thisChangeId === changeCounter) cleanupLastIncludeContent();
});
@ -26650,7 +26763,9 @@ var ngSwitchDefaultDirective = ngDirective({
* @name ng.directive:ngTransclude
*
* @description
* Insert the transcluded DOM here.
* Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
*
* Any existing content of the element that this directive is placed on will be removed before the transcluded content is inserted.
*
* @element ANY
*
@ -26694,16 +26809,19 @@ var ngSwitchDefaultDirective = ngDirective({
*
*/
var ngTranscludeDirective = ngDirective({
controller: ['$transclude', '$element', '$scope', function($transclude, $element, $scope) {
// use evalAsync so that we don't process transclusion before directives on the parent element even when the
// transclusion replaces the current element. (we can't use priority here because that applies only to compile fns
// and not controllers
$scope.$evalAsync(function() {
$transclude(function(clone) {
$element.append(clone);
});
controller: ['$transclude', function($transclude) {
// remember the transclusion fn but call it during linking so that we don't process transclusion before directives on
// the parent element even when the transclusion replaces the current element. (we can't use priority here because
// that applies only to compile fns and not controllers
this.$transclude = $transclude;
}],
link: function($scope, $element, $attrs, controller) {
controller.$transclude(function(clone) {
$element.html('');
$element.append(clone);
});
}]
}
});
/**