=} providers Map of service factory which need to be
@@ -11371,8 +11848,7 @@ function $RootScopeProvider(){
/**
* @ngdoc property
- * @name ng.$rootScope.Scope#$id
- * @propertyOf ng.$rootScope.Scope
+ * @name $rootScope.Scope#$id
* @returns {number} Unique scope ID (monotonically increasing alphanumeric sequence) useful for
* debugging.
*/
@@ -11381,19 +11857,18 @@ function $RootScopeProvider(){
Scope.prototype = {
constructor: Scope,
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$new
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$new
+ * @kind function
*
* @description
* Creates a new child {@link ng.$rootScope.Scope scope}.
*
- * The parent scope will propagate the {@link ng.$rootScope.Scope#methods_$digest $digest()} and
- * {@link ng.$rootScope.Scope#methods_$digest $digest()} events. The scope can be removed from the
- * scope hierarchy using {@link ng.$rootScope.Scope#methods_$destroy $destroy()}.
+ * The parent scope will propagate the {@link ng.$rootScope.Scope#$digest $digest()} and
+ * {@link ng.$rootScope.Scope#$digest $digest()} events. The scope can be removed from the
+ * scope hierarchy using {@link ng.$rootScope.Scope#$destroy $destroy()}.
*
- * {@link ng.$rootScope.Scope#methods_$destroy $destroy()} must be called on a scope when it is
+ * {@link ng.$rootScope.Scope#$destroy $destroy()} must be called on a scope when it is
* desired for the scope and its child scopes to be permanently detached from the parent and
* thus stop participating in model change detection and listener notification by invoking.
*
@@ -11416,18 +11891,23 @@ function $RootScopeProvider(){
child.$$asyncQueue = this.$$asyncQueue;
child.$$postDigestQueue = this.$$postDigestQueue;
} else {
- ChildScope = function() {}; // should be anonymous; This is so that when the minifier munges
- // the name it does not become random set of chars. This will then show up as class
- // name in the web inspector.
- ChildScope.prototype = this;
- child = new ChildScope();
- child.$id = nextUid();
+ // Only create a child scope class if somebody asks for one,
+ // but cache it to allow the VM to optimize lookups.
+ if (!this.$$childScopeClass) {
+ this.$$childScopeClass = function() {
+ this.$$watchers = this.$$nextSibling =
+ this.$$childHead = this.$$childTail = null;
+ this.$$listeners = {};
+ this.$$listenerCount = {};
+ this.$id = nextUid();
+ this.$$childScopeClass = null;
+ };
+ this.$$childScopeClass.prototype = this;
+ }
+ child = new this.$$childScopeClass();
}
child['this'] = child;
- child.$$listeners = {};
- child.$$listenerCount = {};
child.$parent = this;
- child.$$watchers = child.$$nextSibling = child.$$childHead = child.$$childTail = null;
child.$$prevSibling = this.$$childTail;
if (this.$$childHead) {
this.$$childTail.$$nextSibling = child;
@@ -11439,37 +11919,40 @@ function $RootScopeProvider(){
},
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$watch
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$watch
+ * @kind function
*
* @description
* Registers a `listener` callback to be executed whenever the `watchExpression` changes.
*
- * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#methods_$digest
+ * - The `watchExpression` is called on every call to {@link ng.$rootScope.Scope#$digest
* $digest()} and should return the value that will be watched. (Since
- * {@link ng.$rootScope.Scope#methods_$digest $digest()} reruns when it detects changes the
+ * {@link ng.$rootScope.Scope#$digest $digest()} reruns when it detects changes the
* `watchExpression` can execute multiple times per
- * {@link ng.$rootScope.Scope#methods_$digest $digest()} and should be idempotent.)
+ * {@link ng.$rootScope.Scope#$digest $digest()} and should be idempotent.)
* - The `listener` is called only when the value from the current `watchExpression` and the
* previous call to `watchExpression` are not equal (with the exception of the initial run,
- * see below). The inequality is determined according to
- * {@link angular.equals} function. To save the value of the object for later comparison,
- * the {@link angular.copy} function is used. It also means that watching complex options
- * will have adverse memory and performance implications.
+ * see below). Inequality is determined according to reference inequality,
+ * [strict comparison](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Comparison_Operators)
+ * via the `!==` Javascript operator, unless `objectEquality == true`
+ * (see next point)
+ * - When `objectEquality == true`, inequality of the `watchExpression` is determined
+ * according to the {@link angular.equals} function. To save the value of the object for
+ * later comparison, the {@link angular.copy} function is used. This therefore means that
+ * watching complex objects will have adverse memory and performance implications.
* - The watch `listener` may change the model, which may trigger other `listener`s to fire.
* This is achieved by rerunning the watchers until no changes are detected. The rerun
* iteration limit is 10 to prevent an infinite loop deadlock.
*
*
- * If you want to be notified whenever {@link ng.$rootScope.Scope#methods_$digest $digest} is called,
+ * If you want to be notified whenever {@link ng.$rootScope.Scope#$digest $digest} is called,
* you can register a `watchExpression` function with no `listener`. (Since `watchExpression`
- * can execute multiple times per {@link ng.$rootScope.Scope#methods_$digest $digest} cycle when a
+ * can execute multiple times per {@link ng.$rootScope.Scope#$digest $digest} cycle when a
* change is detected, be prepared for multiple calls to your listener.)
*
* After a watcher is registered with the scope, the `listener` fn is called asynchronously
- * (via {@link ng.$rootScope.Scope#methods_$evalAsync $evalAsync}) to initialize the
+ * (via {@link ng.$rootScope.Scope#$evalAsync $evalAsync}) to initialize the
* watcher. In rare cases, this is undesirable because the listener is called when the result
* of `watchExpression` didn't change. To detect this scenario within the `listener` fn, you
* can compare the `newVal` and `oldVal`. If these two values are identical (`===`) then the
@@ -11479,7 +11962,7 @@ function $RootScopeProvider(){
*
*
* # Example
- *
+ * ```js
// let's assume that scope was dependency injected as the $rootScope
var scope = $rootScope;
scope.name = 'misko';
@@ -11492,13 +11975,17 @@ function $RootScopeProvider(){
expect(scope.counter).toEqual(0);
scope.$digest();
- // no variable change
- expect(scope.counter).toEqual(0);
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
- scope.name = 'adam';
scope.$digest();
+ // but now it will not be called unless the value changes
expect(scope.counter).toEqual(1);
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+
// Using a listener function
@@ -11528,12 +12015,12 @@ function $RootScopeProvider(){
scope.$digest();
expect(scope.foodCounter).toEqual(1);
- *
+ * ```
*
*
*
* @param {(function()|string)} watchExpression Expression that is evaluated on each
- * {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. A change in the return value triggers
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. A change in the return value triggers
* a call to the `listener`.
*
* - `string`: Evaluated as {@link guide/expression expression}
@@ -11545,7 +12032,8 @@ function $RootScopeProvider(){
* - `function(newValue, oldValue, scope)`: called with current and previous values as
* parameters.
*
- * @param {boolean=} objectEquality Compare object for equality rather than for reference.
+ * @param {boolean=} objectEquality Compare for object equality using {@link angular.equals} instead of
+ * comparing for reference equality.
* @returns {function()} Returns a deregistration function for this listener.
*/
$watch: function(watchExp, listener, objectEquality) {
@@ -11583,7 +12071,7 @@ function $RootScopeProvider(){
// the while loop reads in reverse order.
array.unshift(watcher);
- return function() {
+ return function deregisterWatch() {
arrayRemove(array, watcher);
lastDirtyWatch = null;
};
@@ -11591,10 +12079,9 @@ function $RootScopeProvider(){
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$watchCollection
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$watchCollection
+ * @kind function
*
* @description
* Shallow watches the properties of an object and fires whenever any of the properties change
@@ -11608,7 +12095,7 @@ function $RootScopeProvider(){
*
*
* # Example
- *
+ * ```js
$scope.names = ['igor', 'matias', 'misko', 'james'];
$scope.dataCount = 4;
@@ -11627,38 +12114,48 @@ function $RootScopeProvider(){
//now there's been a change
expect($scope.dataCount).toEqual(3);
- *
+ * ```
*
*
- * @param {string|Function(scope)} obj Evaluated as {@link guide/expression expression}. The
+ * @param {string|function(scope)} obj Evaluated as {@link guide/expression expression}. The
* expression value should evaluate to an object or an array which is observed on each
- * {@link ng.$rootScope.Scope#methods_$digest $digest} cycle. Any shallow change within the
+ * {@link ng.$rootScope.Scope#$digest $digest} cycle. Any shallow change within the
* collection will trigger a call to the `listener`.
*
- * @param {function(newCollection, oldCollection, scope)} listener a callback function that is
- * fired with both the `newCollection` and `oldCollection` as parameters.
- * The `newCollection` object is the newly modified data obtained from the `obj` expression
- * and the `oldCollection` object is a copy of the former collection data.
- * The `scope` refers to the current scope.
+ * @param {function(newCollection, oldCollection, scope)} listener a callback function called
+ * when a change is detected.
+ * - The `newCollection` object is the newly modified data obtained from the `obj` expression
+ * - The `oldCollection` object is a copy of the former collection data.
+ * Due to performance considerations, the`oldCollection` value is computed only if the
+ * `listener` function declares two or more arguments.
+ * - The `scope` argument refers to the current scope.
*
* @returns {function()} Returns a de-registration function for this listener. When the
* de-registration function is executed, the internal watch operation is terminated.
*/
$watchCollection: function(obj, listener) {
var self = this;
- var oldValue;
+ // the current value, updated on each dirty-check run
var newValue;
+ // a shallow copy of the newValue from the last dirty-check run,
+ // updated to match newValue during dirty-check run
+ var oldValue;
+ // a shallow copy of the newValue from when the last change happened
+ var veryOldValue;
+ // only track veryOldValue if the listener is asking for it
+ var trackVeryOldValue = (listener.length > 1);
var changeDetected = 0;
var objGetter = $parse(obj);
var internalArray = [];
var internalObject = {};
+ var initRun = true;
var oldLength = 0;
function $watchCollectionWatch() {
newValue = objGetter(self);
var newLength, key;
- if (!isObject(newValue)) {
+ if (!isObject(newValue)) { // if primitive
if (oldValue !== newValue) {
oldValue = newValue;
changeDetected++;
@@ -11680,7 +12177,9 @@ function $RootScopeProvider(){
}
// copy the items to oldValue and look for changes.
for (var i = 0; i < newLength; i++) {
- if (oldValue[i] !== newValue[i]) {
+ var bothNaN = (oldValue[i] !== oldValue[i]) &&
+ (newValue[i] !== newValue[i]);
+ if (!bothNaN && (oldValue[i] !== newValue[i])) {
changeDetected++;
oldValue[i] = newValue[i];
}
@@ -11724,40 +12223,64 @@ function $RootScopeProvider(){
}
function $watchCollectionAction() {
- listener(newValue, oldValue, self);
+ if (initRun) {
+ initRun = false;
+ listener(newValue, newValue, self);
+ } else {
+ listener(newValue, veryOldValue, self);
+ }
+
+ // make a copy for the next time a collection is changed
+ if (trackVeryOldValue) {
+ if (!isObject(newValue)) {
+ //primitive
+ veryOldValue = newValue;
+ } else if (isArrayLike(newValue)) {
+ veryOldValue = new Array(newValue.length);
+ for (var i = 0; i < newValue.length; i++) {
+ veryOldValue[i] = newValue[i];
+ }
+ } else { // if object
+ veryOldValue = {};
+ for (var key in newValue) {
+ if (hasOwnProperty.call(newValue, key)) {
+ veryOldValue[key] = newValue[key];
+ }
+ }
+ }
+ }
}
return this.$watch($watchCollectionWatch, $watchCollectionAction);
},
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$digest
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$digest
+ * @kind function
*
* @description
- * Processes all of the {@link ng.$rootScope.Scope#methods_$watch watchers} of the current scope and
- * its children. Because a {@link ng.$rootScope.Scope#methods_$watch watcher}'s listener can change
- * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#methods_$watch watchers}
+ * Processes all of the {@link ng.$rootScope.Scope#$watch watchers} of the current scope and
+ * its children. Because a {@link ng.$rootScope.Scope#$watch watcher}'s listener can change
+ * the model, the `$digest()` keeps calling the {@link ng.$rootScope.Scope#$watch watchers}
* until no more listeners are firing. This means that it is possible to get into an infinite
* loop. This function will throw `'Maximum iteration limit exceeded.'` if the number of
* iterations exceeds 10.
*
* Usually, you don't call `$digest()` directly in
* {@link ng.directive:ngController controllers} or in
- * {@link ng.$compileProvider#methods_directive directives}.
- * Instead, you should call {@link ng.$rootScope.Scope#methods_$apply $apply()} (typically from within
- * a {@link ng.$compileProvider#methods_directive directives}), which will force a `$digest()`.
+ * {@link ng.$compileProvider#directive directives}.
+ * Instead, you should call {@link ng.$rootScope.Scope#$apply $apply()} (typically from within
+ * a {@link ng.$compileProvider#directive directives}), which will force a `$digest()`.
*
* If you want to be notified whenever `$digest()` is called,
* you can register a `watchExpression` function with
- * {@link ng.$rootScope.Scope#methods_$watch $watch()} with no `listener`.
+ * {@link ng.$rootScope.Scope#$watch $watch()} with no `listener`.
*
* In unit tests, you may need to call `$digest()` to simulate the scope life cycle.
*
* # Example
- *
+ * ```js
var scope = ...;
scope.name = 'misko';
scope.counter = 0;
@@ -11769,13 +12292,17 @@ function $RootScopeProvider(){
expect(scope.counter).toEqual(0);
scope.$digest();
- // no variable change
- expect(scope.counter).toEqual(0);
+ // the listener is always called during the first $digest loop after it was registered
+ expect(scope.counter).toEqual(1);
- scope.name = 'adam';
scope.$digest();
+ // but now it will not be called unless the value changes
expect(scope.counter).toEqual(1);
- *
+
+ scope.name = 'adam';
+ scope.$digest();
+ expect(scope.counter).toEqual(2);
+ * ```
*
*/
$digest: function() {
@@ -11826,7 +12353,7 @@ function $RootScopeProvider(){
&& isNaN(value) && isNaN(last)))) {
dirty = true;
lastDirtyWatch = watch;
- watch.last = watch.eq ? copy(value) : value;
+ watch.last = watch.eq ? copy(value, null) : value;
watch.fn(value, ((last === initWatchVal) ? value : last), current);
if (ttl < 5) {
logIdx = 4 - ttl;
@@ -11888,8 +12415,7 @@ function $RootScopeProvider(){
/**
* @ngdoc event
- * @name ng.$rootScope.Scope#$destroy
- * @eventOf ng.$rootScope.Scope
+ * @name $rootScope.Scope#$destroy
* @eventType broadcast on scope being destroyed
*
* @description
@@ -11900,14 +12426,13 @@ function $RootScopeProvider(){
*/
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$destroy
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$destroy
+ * @kind function
*
* @description
* Removes the current scope (and all of its children) from the parent scope. Removal implies
- * that calls to {@link ng.$rootScope.Scope#methods_$digest $digest()} will no longer
+ * that calls to {@link ng.$rootScope.Scope#$digest $digest()} will no longer
* propagate to the current scope and its children. Removal also implies that the current
* scope is eligible for garbage collection.
*
@@ -11933,22 +12458,38 @@ function $RootScopeProvider(){
forEach(this.$$listenerCount, bind(null, decrementListenerCount, this));
+ // sever all the references to parent scopes (after this cleanup, the current scope should
+ // not be retained by any of our references and should be eligible for garbage collection)
if (parent.$$childHead == this) parent.$$childHead = this.$$nextSibling;
if (parent.$$childTail == this) parent.$$childTail = this.$$prevSibling;
if (this.$$prevSibling) this.$$prevSibling.$$nextSibling = this.$$nextSibling;
if (this.$$nextSibling) this.$$nextSibling.$$prevSibling = this.$$prevSibling;
- // This is bogus code that works around Chrome's GC leak
- // see: https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
+ // All of the code below is bogus code that works around V8's memory leak via optimized code
+ // and inline caches.
+ //
+ // see:
+ // - https://code.google.com/p/v8/issues/detail?id=2073#c26
+ // - https://github.com/angular/angular.js/issues/6794#issuecomment-38648909
+ // - https://github.com/angular/angular.js/issues/1313#issuecomment-10378451
+
this.$parent = this.$$nextSibling = this.$$prevSibling = this.$$childHead =
- this.$$childTail = null;
+ this.$$childTail = this.$root = null;
+
+ // don't reset these to null in case some async task tries to register a listener/watch/task
+ this.$$listeners = {};
+ this.$$watchers = this.$$asyncQueue = this.$$postDigestQueue = [];
+
+ // prevent NPEs since these methods have references to properties we nulled out
+ this.$destroy = this.$digest = this.$apply = noop;
+ this.$on = this.$watch = function() { return noop; };
},
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$eval
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$eval
+ * @kind function
*
* @description
* Executes the `expression` on the current scope and returns the result. Any exceptions in
@@ -11956,14 +12497,14 @@ function $RootScopeProvider(){
* expressions.
*
* # Example
- *
+ * ```js
var scope = ng.$rootScope.Scope();
scope.a = 1;
scope.b = 2;
expect(scope.$eval('a+b')).toEqual(3);
expect(scope.$eval(function(scope){ return scope.a + scope.b; })).toEqual(3);
- *
+ * ```
*
* @param {(string|function())=} expression An angular expression to be executed.
*
@@ -11978,10 +12519,9 @@ function $RootScopeProvider(){
},
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$evalAsync
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$evalAsync
+ * @kind function
*
* @description
* Executes the expression on the current scope at a later point in time.
@@ -11991,7 +12531,7 @@ function $RootScopeProvider(){
*
* - it will execute after the function that scheduled the evaluation (preferably before DOM
* rendering).
- * - at least one {@link ng.$rootScope.Scope#methods_$digest $digest cycle} will be performed after
+ * - 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
@@ -12026,22 +12566,21 @@ function $RootScopeProvider(){
},
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$apply
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$apply
+ * @kind function
*
* @description
* `$apply()` is used to execute an expression in angular from outside of the angular
* framework. (For example from browser DOM events, setTimeout, XHR or third party libraries).
* Because we are calling into the angular framework we need to perform proper scope life
* cycle of {@link ng.$exceptionHandler exception handling},
- * {@link ng.$rootScope.Scope#methods_$digest executing watches}.
+ * {@link ng.$rootScope.Scope#$digest executing watches}.
*
* ## Life cycle
*
* # Pseudo-Code of `$apply()`
- *
+ * ```js
function $apply(expr) {
try {
return $eval(expr);
@@ -12051,17 +12590,17 @@ function $RootScopeProvider(){
$root.$digest();
}
}
- *
+ * ```
*
*
* Scope's `$apply()` method transitions through the following stages:
*
* 1. The {@link guide/expression expression} is executed using the
- * {@link ng.$rootScope.Scope#methods_$eval $eval()} method.
+ * {@link ng.$rootScope.Scope#$eval $eval()} method.
* 2. Any exceptions from the execution of the expression are forwarded to the
* {@link ng.$exceptionHandler $exceptionHandler} service.
- * 3. The {@link ng.$rootScope.Scope#methods_$watch watch} listeners are fired immediately after the
- * expression was executed using the {@link ng.$rootScope.Scope#methods_$digest $digest()} method.
+ * 3. The {@link ng.$rootScope.Scope#$watch watch} listeners are fired immediately after the
+ * expression was executed using the {@link ng.$rootScope.Scope#$digest $digest()} method.
*
*
* @param {(string|function())=} exp An angular expression to be executed.
@@ -12089,13 +12628,12 @@ function $RootScopeProvider(){
},
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$on
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$on
+ * @kind function
*
* @description
- * Listens on events of a given type. See {@link ng.$rootScope.Scope#methods_$emit $emit} for
+ * Listens on events of a given type. See {@link ng.$rootScope.Scope#$emit $emit} for
* discussion of event life cycle.
*
* The event listener function format is: `function(event, args...)`. The `event` object
@@ -12112,7 +12650,7 @@ function $RootScopeProvider(){
* - `defaultPrevented` - `{boolean}`: true if `preventDefault` was called.
*
* @param {string} name Event name to listen on.
- * @param {function(event, args...)} listener Function to call when the event is emitted.
+ * @param {function(event, ...args)} listener Function to call when the event is emitted.
* @returns {function()} Returns a deregistration function for this listener.
*/
$on: function(name, listener) {
@@ -12139,27 +12677,26 @@ function $RootScopeProvider(){
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$emit
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$emit
+ * @kind function
*
* @description
* Dispatches an event `name` upwards through the scope hierarchy notifying the
- * registered {@link ng.$rootScope.Scope#methods_$on} listeners.
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
*
* The event life cycle starts at the scope on which `$emit` was called. All
- * {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
* notified. Afterwards, the event traverses upwards toward the root scope and calls all
* registered listeners along the way. The event will stop propagating if one of the listeners
* cancels it.
*
- * Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {string} name Event name to emit.
* @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
- * @return {Object} Event object (see {@link ng.$rootScope.Scope#methods_$on}).
+ * @return {Object} Event object (see {@link ng.$rootScope.Scope#$on}).
*/
$emit: function(name, args) {
var empty = [],
@@ -12208,26 +12745,25 @@ function $RootScopeProvider(){
/**
- * @ngdoc function
- * @name ng.$rootScope.Scope#$broadcast
- * @methodOf ng.$rootScope.Scope
- * @function
+ * @ngdoc method
+ * @name $rootScope.Scope#$broadcast
+ * @kind function
*
* @description
* Dispatches an event `name` downwards to all child scopes (and their children) notifying the
- * registered {@link ng.$rootScope.Scope#methods_$on} listeners.
+ * registered {@link ng.$rootScope.Scope#$on} listeners.
*
* The event life cycle starts at the scope on which `$broadcast` was called. All
- * {@link ng.$rootScope.Scope#methods_$on listeners} listening for `name` event on this scope get
+ * {@link ng.$rootScope.Scope#$on listeners} listening for `name` event on this scope get
* notified. Afterwards, the event propagates to all direct and indirect scopes of the current
* scope and calls all registered listeners along the way. The event cannot be canceled.
*
- * Any exception emitted from the {@link ng.$rootScope.Scope#methods_$on listeners} will be passed
+ * Any exception emitted from the {@link ng.$rootScope.Scope#$on listeners} will be passed
* onto the {@link ng.$exceptionHandler $exceptionHandler} service.
*
* @param {string} name Event name to broadcast.
* @param {...*} args Optional one or more arguments which will be passed onto the event listeners.
- * @return {Object} Event object, see {@link ng.$rootScope.Scope#methods_$on}
+ * @return {Object} Event object, see {@link ng.$rootScope.Scope#$on}
*/
$broadcast: function(name, args) {
var target = this,
@@ -12458,8 +12994,8 @@ function adjustMatchers(matchers) {
/**
* @ngdoc service
- * @name ng.$sceDelegate
- * @function
+ * @name $sceDelegate
+ * @kind function
*
* @description
*
@@ -12478,21 +13014,21 @@ function adjustMatchers(matchers) {
* can override it completely to change the behavior of `$sce`, the common case would
* involve configuring the {@link ng.$sceDelegateProvider $sceDelegateProvider} instead by setting
* your own whitelists and blacklists for trusting URLs used for loading AngularJS resources such as
- * templates. Refer {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist
+ * templates. Refer {@link ng.$sceDelegateProvider#resourceUrlWhitelist
* $sceDelegateProvider.resourceUrlWhitelist} and {@link
- * ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ * ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
*/
/**
- * @ngdoc object
- * @name ng.$sceDelegateProvider
+ * @ngdoc provider
+ * @name $sceDelegateProvider
* @description
*
* The `$sceDelegateProvider` provider allows developers to configure the {@link ng.$sceDelegate
* $sceDelegate} service. This allows one to get/set the whitelists and blacklists used to ensure
* that the URLs used for sourcing Angular templates are safe. Refer {@link
- * ng.$sceDelegateProvider#methods_resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
- * {@link ng.$sceDelegateProvider#methods_resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
+ * ng.$sceDelegateProvider#resourceUrlWhitelist $sceDelegateProvider.resourceUrlWhitelist} and
+ * {@link ng.$sceDelegateProvider#resourceUrlBlacklist $sceDelegateProvider.resourceUrlBlacklist}
*
* For the general details about this service in Angular, read the main page for {@link ng.$sce
* Strict Contextual Escaping (SCE)}.
@@ -12529,10 +13065,9 @@ function $SceDelegateProvider() {
resourceUrlBlacklist = [];
/**
- * @ngdoc function
- * @name ng.sceDelegateProvider#resourceUrlWhitelist
- * @methodOf ng.$sceDelegateProvider
- * @function
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlWhitelist
+ * @kind function
*
* @param {Array=} whitelist When provided, replaces the resourceUrlWhitelist with the value
* provided. This must be an array or null. A snapshot of this array is used so further
@@ -12559,10 +13094,9 @@ function $SceDelegateProvider() {
};
/**
- * @ngdoc function
- * @name ng.sceDelegateProvider#resourceUrlBlacklist
- * @methodOf ng.$sceDelegateProvider
- * @function
+ * @ngdoc method
+ * @name $sceDelegateProvider#resourceUrlBlacklist
+ * @kind function
*
* @param {Array=} blacklist When provided, replaces the resourceUrlBlacklist with the value
* provided. This must be an array or null. A snapshot of this array is used so further
@@ -12664,8 +13198,7 @@ function $SceDelegateProvider() {
/**
* @ngdoc method
- * @name ng.$sceDelegate#trustAs
- * @methodOf ng.$sceDelegate
+ * @name $sceDelegate#trustAs
*
* @description
* Returns an object that is trusted by angular for use in specified strict
@@ -12702,20 +13235,19 @@ function $SceDelegateProvider() {
/**
* @ngdoc method
- * @name ng.$sceDelegate#valueOf
- * @methodOf ng.$sceDelegate
+ * @name $sceDelegate#valueOf
*
* @description
- * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#methods_trustAs
+ * If the passed parameter had been returned by a prior call to {@link ng.$sceDelegate#trustAs
* `$sceDelegate.trustAs`}, returns the value that had been passed to {@link
- * ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}.
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}.
*
* If the passed parameter is not a value that had been returned by {@link
- * ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}, returns it as-is.
+ * ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}, returns it as-is.
*
- * @param {*} value The result of a prior {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}
+ * @param {*} value The result of a prior {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}
* call or anything else.
- * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#methods_trustAs
+ * @returns {*} The `value` that was originally provided to {@link ng.$sceDelegate#trustAs
* `$sceDelegate.trustAs`} if `value` is the result of such a call. Otherwise, returns
* `value` unchanged.
*/
@@ -12729,18 +13261,17 @@ function $SceDelegateProvider() {
/**
* @ngdoc method
- * @name ng.$sceDelegate#getTrusted
- * @methodOf ng.$sceDelegate
+ * @name $sceDelegate#getTrusted
*
* @description
- * Takes the result of a {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`} call and
+ * Takes the result of a {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`} call and
* returns the originally supplied value if the queried context type is a supertype of the
* created type. If this condition isn't satisfied, throws an exception.
*
* @param {string} type The kind of context in which this value is to be used.
- * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#methods_trustAs
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sceDelegate#trustAs
* `$sceDelegate.trustAs`} call.
- * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#methods_trustAs
+ * @returns {*} The value the was originally provided to {@link ng.$sceDelegate#trustAs
* `$sceDelegate.trustAs`} if valid in this context. Otherwise, throws an exception.
*/
function getTrusted(type, maybeTrusted) {
@@ -12776,8 +13307,8 @@ function $SceDelegateProvider() {
/**
- * @ngdoc object
- * @name ng.$sceProvider
+ * @ngdoc provider
+ * @name $sceProvider
* @description
*
* The $sceProvider provider allows developers to configure the {@link ng.$sce $sce} service.
@@ -12791,8 +13322,8 @@ function $SceDelegateProvider() {
/**
* @ngdoc service
- * @name ng.$sce
- * @function
+ * @name $sce
+ * @kind function
*
* @description
*
@@ -12845,20 +13376,20 @@ function $SceDelegateProvider() {
* allowing only the files in a specific directory to do this. Ensuring that the internal API
* exposed by that code doesn't markup arbitrary values as safe then becomes a more manageable task.
*
- * In the case of AngularJS' SCE service, one uses {@link ng.$sce#methods_trustAs $sce.trustAs}
- * (and shorthand methods such as {@link ng.$sce#methods_trustAsHtml $sce.trustAsHtml}, etc.) to
+ * In the case of AngularJS' SCE service, one uses {@link ng.$sce#trustAs $sce.trustAs}
+ * (and shorthand methods such as {@link ng.$sce#trustAsHtml $sce.trustAsHtml}, etc.) to
* obtain values that will be accepted by SCE / privileged contexts.
*
*
* ## How does it work?
*
- * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#methods_getTrusted
+ * In privileged contexts, directives and code will bind to the result of {@link ng.$sce#getTrusted
* $sce.getTrusted(context, value)} rather than to the value directly. Directives use {@link
- * ng.$sce#methods_parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
- * {@link ng.$sce#methods_getTrusted $sce.getTrusted} behind the scenes on non-constant literals.
+ * ng.$sce#parse $sce.parseAs} rather than `$parse` to watch attribute bindings, which performs the
+ * {@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#methods_parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
+ * ng.$sce#parseAsHtml $sce.parseAsHtml(binding expression)}. Here's the actual code (slightly
* simplified):
*
*
@@ -12877,15 +13408,15 @@ function $SceDelegateProvider() {
* `templateUrl`'s specified by {@link guide/directive directives}.
*
* By default, Angular only loads templates from the same domain and protocol as the application
- * document. This is done by calling {@link ng.$sce#methods_getTrustedResourceUrl
+ * document. This is done by calling {@link ng.$sce#getTrustedResourceUrl
* $sce.getTrustedResourceUrl} on the template URL. To load templates from other domains and/or
- * protocols, you may either either {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelist
- * them} or {@link ng.$sce#methods_trustAsResourceUrl wrap it} into a trusted value.
+ * protocols, you may either either {@link ng.$sceDelegateProvider#resourceUrlWhitelist whitelist
+ * them} or {@link ng.$sce#trustAsResourceUrl wrap it} into a trusted value.
*
* *Please note*:
* The browser's
- * {@link https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest
- * Same Origin Policy} and {@link http://www.w3.org/TR/cors/ Cross-Origin Resource Sharing (CORS)}
+ * [Same Origin Policy](https://code.google.com/p/browsersec/wiki/Part2#Same-origin_policy_for_XMLHttpRequest)
+ * and [Cross-Origin Resource Sharing (CORS)](http://www.w3.org/TR/cors/)
* policy apply in addition to this and may further restrict whether the template is successfully
* loaded. This means that without the right CORS policy, loading templates from a different domain
* won't work on all browsers. Also, loading templates from `file://` URL does not work on some
@@ -12900,14 +13431,14 @@ function $SceDelegateProvider() {
* `
`) just works.
*
* Additionally, `a[href]` and `img[src]` automatically sanitize their URLs and do not pass them
- * through {@link ng.$sce#methods_getTrusted $sce.getTrusted}. SCE doesn't play a role here.
+ * through {@link ng.$sce#getTrusted $sce.getTrusted}. SCE doesn't play a role here.
*
* The included {@link ng.$sceDelegate $sceDelegate} comes with sane defaults to allow you to load
* templates in `ng-include` from your application's domain without having to even know about SCE.
* It blocks loading templates from other domains or loading templates over http from an https
* served document. You can change these by setting your own custom {@link
- * ng.$sceDelegateProvider#methods_resourceUrlWhitelist whitelists} and {@link
- * ng.$sceDelegateProvider#methods_resourceUrlBlacklist blacklists} for matching such URLs.
+ * ng.$sceDelegateProvider#resourceUrlWhitelist whitelists} and {@link
+ * ng.$sceDelegateProvider#resourceUrlBlacklist blacklists} for matching such URLs.
*
* This significantly reduces the overhead. It is far easier to pay the small overhead and have an
* application that's secure and can be audited to verify that with much more ease than bolting
@@ -12918,13 +13449,13 @@ function $SceDelegateProvider() {
*
* | 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.HTML` | For HTML that's safe to source into the application. The {@link ng.directive:ngBindHtml ngBindHtml} directive uses this context for bindings. If an unsafe value is encountered and the {@link ngSanitize $sanitize} module is present this will sanitize the value instead of throwing an error. |
* | `$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 (` Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
+ * | `$sce.URL` | For URLs that are safe to follow as links. Currently unused (` Note that `$sce.RESOURCE_URL` makes a stronger statement about the URL than `$sce.URL` does and therefore contexts requiring values trusted for `$sce.RESOURCE_URL` can be used anywhere that values trusted for `$sce.URL` are required. |
* | `$sce.JS` | For JavaScript that is safe to execute in your application's context. Currently unused. Feel free to use it in your own directives. |
*
- * ## Format of items in {@link ng.$sceDelegateProvider#methods_resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#methods_resourceUrlBlacklist Blacklist}
+ * ## Format of items in {@link ng.$sceDelegateProvider#resourceUrlWhitelist resourceUrlWhitelist}/{@link ng.$sceDelegateProvider#resourceUrlBlacklist Blacklist}
*
* Each element in these arrays must be one of the following:
*
@@ -12936,13 +13467,13 @@ function $SceDelegateProvider() {
* being tested (substring matches are not good enough.)
* - There are exactly **two wildcard sequences** - `*` and `**`. All other characters
* match themselves.
- * - `*`: matches zero or more occurances of any character other than one of the following 6
+ * - `*`: matches zero or more occurrences of any character other than one of the following 6
* characters: '`:`', '`/`', '`.`', '`?`', '`&`' and ';'. It's a useful wildcard for use
* in a whitelist.
- * - `**`: matches zero or more occurances of *any* character. As such, it's not
+ * - `**`: matches zero or more occurrences of *any* character. As such, it's not
* not appropriate to use in for a scheme, domain, etc. as it would match too much. (e.g.
* http://**.example.com/ would match http://evil.com/?ignore=.example.com/ and that might
- * not have been the intention.) It's usage at the very end of the path is ok. (e.g.
+ * not have been the intention.) Its usage at the very end of the path is ok. (e.g.
* http://foo.example.com/templates/**).
* - **RegExp** (*see caveat below*)
* - *Caveat*: While regular expressions are powerful and offer great flexibility, their syntax
@@ -13018,7 +13549,7 @@ function $SceDelegateProvider() {
]
-
+
describe('SCE doc demo', function() {
it('should sanitize untrusted values', function() {
expect(element(by.css('.htmlComment')).getInnerHtml())
@@ -13061,10 +13592,9 @@ function $SceProvider() {
var enabled = true;
/**
- * @ngdoc function
- * @name ng.sceProvider#enabled
- * @methodOf ng.$sceProvider
- * @function
+ * @ngdoc method
+ * @name $sceProvider#enabled
+ * @kind function
*
* @param {boolean=} value If provided, then enables/disables SCE.
* @return {boolean} true if SCE is enabled, false otherwise.
@@ -13137,13 +13667,12 @@ function $SceProvider() {
'document. See http://docs.angularjs.org/api/ng.$sce for more information.');
}
- var sce = copy(SCE_CONTEXTS);
+ var sce = shallowCopy(SCE_CONTEXTS);
/**
- * @ngdoc function
- * @name ng.sce#isEnabled
- * @methodOf ng.$sce
- * @function
+ * @ngdoc method
+ * @name $sce#isEnabled
+ * @kind function
*
* @return {Boolean} true if SCE is enabled, false otherwise. If you want to set the value, you
* have to do it at module config time on {@link ng.$sceProvider $sceProvider}.
@@ -13165,13 +13694,12 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#parse
- * @methodOf ng.$sce
+ * @name $sce#parse
*
* @description
* Converts Angular {@link guide/expression expression} into a function. This is like {@link
* ng.$parse $parse} and is identical when the expression is a literal constant. Otherwise, it
- * wraps the expression in a call to {@link ng.$sce#methods_getTrusted $sce.getTrusted(*type*,
+ * wraps the expression in a call to {@link ng.$sce#getTrusted $sce.getTrusted(*type*,
* *result*)}
*
* @param {string} type The kind of SCE context in which this result will be used.
@@ -13196,11 +13724,10 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#trustAs
- * @methodOf ng.$sce
+ * @name $sce#trustAs
*
* @description
- * Delegates to {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs`}. As such,
+ * Delegates to {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs`}. As such,
* returns an object that is trusted by angular for use in specified strict contextual
* escaping contexts (such as ng-bind-html, ng-include, any src attribute
* interpolation, any dom event binding attribute interpolation such as for onclick, etc.)
@@ -13216,95 +13743,89 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#trustAsHtml
- * @methodOf ng.$sce
+ * @name $sce#trustAsHtml
*
* @description
* Shorthand method. `$sce.trustAsHtml(value)` →
- * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.HTML, value)`}
*
* @param {*} value The value to trustAs.
- * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedHtml
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedHtml
* $sce.getTrustedHtml(value)} to obtain the original value. (privileged directives
* only accept expressions that are either literal constants or are the
- * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.)
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
*/
/**
* @ngdoc method
- * @name ng.$sce#trustAsUrl
- * @methodOf ng.$sce
+ * @name $sce#trustAsUrl
*
* @description
* Shorthand method. `$sce.trustAsUrl(value)` →
- * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.URL, value)`}
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.URL, value)`}
*
* @param {*} value The value to trustAs.
- * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedUrl
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedUrl
* $sce.getTrustedUrl(value)} to obtain the original value. (privileged directives
* only accept expressions that are either literal constants or are the
- * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.)
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
*/
/**
* @ngdoc method
- * @name ng.$sce#trustAsResourceUrl
- * @methodOf ng.$sce
+ * @name $sce#trustAsResourceUrl
*
* @description
* Shorthand method. `$sce.trustAsResourceUrl(value)` →
- * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.RESOURCE_URL, value)`}
*
* @param {*} value The value to trustAs.
- * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedResourceUrl
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedResourceUrl
* $sce.getTrustedResourceUrl(value)} to obtain the original value. (privileged directives
* only accept expressions that are either literal constants or are the return
- * value of {@link ng.$sce#methods_trustAs $sce.trustAs}.)
+ * value of {@link ng.$sce#trustAs $sce.trustAs}.)
*/
/**
* @ngdoc method
- * @name ng.$sce#trustAsJs
- * @methodOf ng.$sce
+ * @name $sce#trustAsJs
*
* @description
* Shorthand method. `$sce.trustAsJs(value)` →
- * {@link ng.$sceDelegate#methods_trustAs `$sceDelegate.trustAs($sce.JS, value)`}
+ * {@link ng.$sceDelegate#trustAs `$sceDelegate.trustAs($sce.JS, value)`}
*
* @param {*} value The value to trustAs.
- * @returns {*} An object that can be passed to {@link ng.$sce#methods_getTrustedJs
+ * @returns {*} An object that can be passed to {@link ng.$sce#getTrustedJs
* $sce.getTrustedJs(value)} to obtain the original value. (privileged directives
* only accept expressions that are either literal constants or are the
- * return value of {@link ng.$sce#methods_trustAs $sce.trustAs}.)
+ * return value of {@link ng.$sce#trustAs $sce.trustAs}.)
*/
/**
* @ngdoc method
- * @name ng.$sce#getTrusted
- * @methodOf ng.$sce
+ * @name $sce#getTrusted
*
* @description
- * Delegates to {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted`}. As such,
- * takes the result of a {@link ng.$sce#methods_trustAs `$sce.trustAs`}() call and returns the
+ * Delegates to {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted`}. As such,
+ * takes the result of a {@link ng.$sce#trustAs `$sce.trustAs`}() call and returns the
* originally supplied value if the queried context type is a supertype of the created type.
* If this condition isn't satisfied, throws an exception.
*
* @param {string} type The kind of context in which this value is to be used.
- * @param {*} maybeTrusted The result of a prior {@link ng.$sce#methods_trustAs `$sce.trustAs`}
+ * @param {*} maybeTrusted The result of a prior {@link ng.$sce#trustAs `$sce.trustAs`}
* call.
* @returns {*} The value the was originally provided to
- * {@link ng.$sce#methods_trustAs `$sce.trustAs`} if valid in this context.
+ * {@link ng.$sce#trustAs `$sce.trustAs`} if valid in this context.
* Otherwise, throws an exception.
*/
/**
* @ngdoc method
- * @name ng.$sce#getTrustedHtml
- * @methodOf ng.$sce
+ * @name $sce#getTrustedHtml
*
* @description
* Shorthand method. `$sce.getTrustedHtml(value)` →
- * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.HTML, value)`}
*
* @param {*} value The value to pass to `$sce.getTrusted`.
* @returns {*} The return value of `$sce.getTrusted($sce.HTML, value)`
@@ -13312,12 +13833,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#getTrustedCss
- * @methodOf ng.$sce
+ * @name $sce#getTrustedCss
*
* @description
* Shorthand method. `$sce.getTrustedCss(value)` →
- * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.CSS, value)`}
*
* @param {*} value The value to pass to `$sce.getTrusted`.
* @returns {*} The return value of `$sce.getTrusted($sce.CSS, value)`
@@ -13325,12 +13845,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#getTrustedUrl
- * @methodOf ng.$sce
+ * @name $sce#getTrustedUrl
*
* @description
* Shorthand method. `$sce.getTrustedUrl(value)` →
- * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.URL, value)`}
*
* @param {*} value The value to pass to `$sce.getTrusted`.
* @returns {*} The return value of `$sce.getTrusted($sce.URL, value)`
@@ -13338,12 +13857,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#getTrustedResourceUrl
- * @methodOf ng.$sce
+ * @name $sce#getTrustedResourceUrl
*
* @description
* Shorthand method. `$sce.getTrustedResourceUrl(value)` →
- * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.RESOURCE_URL, value)`}
*
* @param {*} value The value to pass to `$sceDelegate.getTrusted`.
* @returns {*} The return value of `$sce.getTrusted($sce.RESOURCE_URL, value)`
@@ -13351,12 +13869,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#getTrustedJs
- * @methodOf ng.$sce
+ * @name $sce#getTrustedJs
*
* @description
* Shorthand method. `$sce.getTrustedJs(value)` →
- * {@link ng.$sceDelegate#methods_getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
+ * {@link ng.$sceDelegate#getTrusted `$sceDelegate.getTrusted($sce.JS, value)`}
*
* @param {*} value The value to pass to `$sce.getTrusted`.
* @returns {*} The return value of `$sce.getTrusted($sce.JS, value)`
@@ -13364,12 +13881,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#parseAsHtml
- * @methodOf ng.$sce
+ * @name $sce#parseAsHtml
*
* @description
* Shorthand method. `$sce.parseAsHtml(expression string)` →
- * {@link ng.$sce#methods_parse `$sce.parseAs($sce.HTML, value)`}
+ * {@link ng.$sce#parse `$sce.parseAs($sce.HTML, value)`}
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
@@ -13382,12 +13898,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#parseAsCss
- * @methodOf ng.$sce
+ * @name $sce#parseAsCss
*
* @description
* Shorthand method. `$sce.parseAsCss(value)` →
- * {@link ng.$sce#methods_parse `$sce.parseAs($sce.CSS, value)`}
+ * {@link ng.$sce#parse `$sce.parseAs($sce.CSS, value)`}
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
@@ -13400,12 +13915,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#parseAsUrl
- * @methodOf ng.$sce
+ * @name $sce#parseAsUrl
*
* @description
* Shorthand method. `$sce.parseAsUrl(value)` →
- * {@link ng.$sce#methods_parse `$sce.parseAs($sce.URL, value)`}
+ * {@link ng.$sce#parse `$sce.parseAs($sce.URL, value)`}
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
@@ -13418,12 +13932,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#parseAsResourceUrl
- * @methodOf ng.$sce
+ * @name $sce#parseAsResourceUrl
*
* @description
* Shorthand method. `$sce.parseAsResourceUrl(value)` →
- * {@link ng.$sce#methods_parse `$sce.parseAs($sce.RESOURCE_URL, value)`}
+ * {@link ng.$sce#parse `$sce.parseAs($sce.RESOURCE_URL, value)`}
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
@@ -13436,12 +13949,11 @@ function $SceProvider() {
/**
* @ngdoc method
- * @name ng.$sce#parseAsJs
- * @methodOf ng.$sce
+ * @name $sce#parseAsJs
*
* @description
* Shorthand method. `$sce.parseAsJs(value)` →
- * {@link ng.$sce#methods_parse `$sce.parseAs($sce.JS, value)`}
+ * {@link ng.$sce#parse `$sce.parseAs($sce.JS, value)`}
*
* @param {string} expression String expression to compile.
* @returns {function(context, locals)} a function which represents the compiled expression:
@@ -13477,7 +13989,7 @@ function $SceProvider() {
/**
* !!! This is an undocumented "private" service !!!
*
- * @name ng.$sniffer
+ * @name $sniffer
* @requires $window
* @requires $document
*
@@ -13573,9 +14085,8 @@ function $TimeoutProvider() {
/**
- * @ngdoc function
- * @name ng.$timeout
- * @requires $browser
+ * @ngdoc service
+ * @name $timeout
*
* @description
* Angular's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
@@ -13593,10 +14104,10 @@ function $TimeoutProvider() {
* @param {function()} fn A function, whose execution should be delayed.
* @param {number=} [delay=0] Delay in milliseconds.
* @param {boolean=} [invokeApply=true] If set to `false` skips model dirty checking, otherwise
- * will invoke `fn` within the {@link ng.$rootScope.Scope#methods_$apply $apply} block.
+ * will invoke `fn` within the {@link ng.$rootScope.Scope#$apply $apply} block.
* @returns {Promise} Promise that will be resolved when the timeout is reached. The value this
* promise will be resolved with is the return value of the `fn` function.
- *
+ *
*/
function timeout(fn, delay, invokeApply) {
var deferred = $q.defer(),
@@ -13626,9 +14137,8 @@ function $TimeoutProvider() {
/**
- * @ngdoc function
- * @name ng.$timeout#cancel
- * @methodOf ng.$timeout
+ * @ngdoc method
+ * @name $timeout#cancel
*
* @description
* Cancels a task associated with the `promise`. As a result of this, the promise will be
@@ -13697,7 +14207,7 @@ var originUrl = urlResolve(window.location.href, true);
* https://github.com/angular/angular.js/pull/2902
* http://james.padolsey.com/javascript/parsing-urls-with-the-dom/
*
- * @function
+ * @kind function
* @param {string} url The URL to be parsed.
* @description Normalizes and parses a URL.
* @returns {object} Returns the normalized URL as a dictionary.
@@ -13755,8 +14265,8 @@ function urlIsSameOrigin(requestUrl) {
}
/**
- * @ngdoc object
- * @name ng.$window
+ * @ngdoc service
+ * @name $window
*
* @description
* A reference to the browser's `window` object. While `window`
@@ -13770,8 +14280,8 @@ function urlIsSameOrigin(requestUrl) {
* expression.
*
* @example
-
-
+
+
-
-
-
+
+
it('should initialize to model', function() {
var userType = element(by.binding('userType'));
var valid = element(by.binding('myForm.input.$valid'));
@@ -15604,8 +16249,9 @@ function FormController(element, attrs) {
expect(userType.getText()).toEqual('userType =');
expect(valid.getText()).toContain('false');
});
-
-
+
+
+ *
*/
var formDirectiveFactory = function(isNgForm) {
return ['$timeout', function($timeout) {
@@ -15682,8 +16328,8 @@ var NUMBER_REGEXP = /^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/;
var inputType = {
/**
- * @ngdoc inputType
- * @name ng.directive:input.text
+ * @ngdoc input
+ * @name input[text]
*
* @description
* Standard HTML text input with angular data binding.
@@ -15706,8 +16352,8 @@ var inputType = {
* @param {boolean=} [ngTrim=true] If set to false Angular will not automatically trim the input.
*
* @example
-
-
+
+
+
+ Update input to see transitions when valid/invalid.
+ Integer is a valid value.
+
+
+ *
*/
var ngModelDirective = function() {
return {
@@ -16913,7 +17662,7 @@ var ngModelDirective = function() {
/**
* @ngdoc directive
- * @name ng.directive:ngChange
+ * @name ngChange
*
* @description
* Evaluate the given expression when the user changes the input.
@@ -16929,8 +17678,8 @@ var ngModelDirective = function() {
* in input value.
*
* @example
- *
- *
+ *
+ *
*
-
- Name:
- [
greet ]
- Contact:
-
-
-
-
- it('should check controller as', function() {
- var container = element(by.id('ctrl-as-exmpl'));
-
- expect(container.findElement(by.model('settings.name'))
- .getAttribute('value')).toBe('John Smith');
-
- var firstRepeat =
- container.findElement(by.repeater('contact in settings.contacts').row(0));
- var secondRepeat =
- container.findElement(by.repeater('contact in settings.contacts').row(1));
-
- expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
- .toBe('408 555 1212');
- expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
- .toBe('john.smith@example.org');
-
- firstRepeat.findElement(by.linkText('clear')).click()
-
- expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
- .toBe('');
-
- container.findElement(by.linkText('add')).click();
-
- expect(container.findElement(by.repeater('contact in settings.contacts').row(2))
- .findElement(by.model('contact.value'))
- .getAttribute('value'))
- .toBe('yourname@example.org');
- });
-
-
-
-
-
-
- Name:
- [
greet ]
- Contact:
-
-
-
-
- it('should check controller', function() {
- var container = element(by.id('ctrl-exmpl'));
-
- expect(container.findElement(by.model('name'))
- .getAttribute('value')).toBe('John Smith');
-
- var firstRepeat =
- container.findElement(by.repeater('contact in contacts').row(0));
- var secondRepeat =
- container.findElement(by.repeater('contact in contacts').row(1));
-
- expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
- .toBe('408 555 1212');
- expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
- .toBe('john.smith@example.org');
-
- firstRepeat.findElement(by.linkText('clear')).click()
-
- expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
- .toBe('');
-
- container.findElement(by.linkText('add')).click();
-
- expect(container.findElement(by.repeater('contact in contacts').row(2))
- .findElement(by.model('contact.value'))
- .getAttribute('value'))
- .toBe('yourname@example.org');
- });
-
-
+ * easily be called from the angular markup. Any changes to the data are automatically reflected
+ * in the View without the need for a manual update.
+ *
+ * Two different declaration styles are included below:
+ *
+ * * one binds methods and properties directly onto the controller using `this`:
+ * `ng-controller="SettingsController1 as settings"`
+ * * one injects `$scope` into the controller:
+ * `ng-controller="SettingsController2"`
+ *
+ * The second option is more common in the Angular community, and is generally used in boilerplates
+ * and in this guide. However, there are advantages to binding properties directly to the controller
+ * and avoiding scope.
+ *
+ * * Using `controller as` makes it obvious which controller you are accessing in the template when
+ * multiple controllers apply to an element.
+ * * If you are writing your controllers as classes you have easier access to the properties and
+ * methods, which will appear on the scope, from inside the controller code.
+ * * Since there is always a `.` in the bindings, you don't have to worry about prototypal
+ * inheritance masking primitives.
+ *
+ * This example demonstrates the `controller as` syntax.
+ *
+ *
+ *
+ *
+ * Name:
+ * [
greet ]
+ * Contact:
+ *
+ *
+ *
+ *
+ * function SettingsController1() {
+ * this.name = "John Smith";
+ * this.contacts = [
+ * {type: 'phone', value: '408 555 1212'},
+ * {type: 'email', value: 'john.smith@example.org'} ];
+ * }
+ *
+ * SettingsController1.prototype.greet = function() {
+ * alert(this.name);
+ * };
+ *
+ * SettingsController1.prototype.addContact = function() {
+ * this.contacts.push({type: 'email', value: 'yourname@example.org'});
+ * };
+ *
+ * SettingsController1.prototype.removeContact = function(contactToRemove) {
+ * var index = this.contacts.indexOf(contactToRemove);
+ * this.contacts.splice(index, 1);
+ * };
+ *
+ * SettingsController1.prototype.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ *
+ *
+ * it('should check controller as', function() {
+ * var container = element(by.id('ctrl-as-exmpl'));
+ * expect(container.findElement(by.model('settings.name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.findElement(by.repeater('contact in settings.contacts').row(0));
+ * var secondRepeat =
+ * container.findElement(by.repeater('contact in settings.contacts').row(1));
+ *
+ * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ *
+ * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.findElement(by.linkText('clear')).click();
+ *
+ * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.findElement(by.linkText('add')).click();
+ *
+ * expect(container.findElement(by.repeater('contact in settings.contacts').row(2))
+ * .findElement(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ *
+ *
+ *
+ * This example demonstrates the "attach to `$scope`" style of controller.
+ *
+ *
+ *
+ *
+ * Name:
+ * [
greet ]
+ * Contact:
+ *
+ *
+ *
+ *
+ * function SettingsController2($scope) {
+ * $scope.name = "John Smith";
+ * $scope.contacts = [
+ * {type:'phone', value:'408 555 1212'},
+ * {type:'email', value:'john.smith@example.org'} ];
+ *
+ * $scope.greet = function() {
+ * alert($scope.name);
+ * };
+ *
+ * $scope.addContact = function() {
+ * $scope.contacts.push({type:'email', value:'yourname@example.org'});
+ * };
+ *
+ * $scope.removeContact = function(contactToRemove) {
+ * var index = $scope.contacts.indexOf(contactToRemove);
+ * $scope.contacts.splice(index, 1);
+ * };
+ *
+ * $scope.clearContact = function(contact) {
+ * contact.type = 'phone';
+ * contact.value = '';
+ * };
+ * }
+ *
+ *
+ * it('should check controller', function() {
+ * var container = element(by.id('ctrl-exmpl'));
+ *
+ * expect(container.findElement(by.model('name'))
+ * .getAttribute('value')).toBe('John Smith');
+ *
+ * var firstRepeat =
+ * container.findElement(by.repeater('contact in contacts').row(0));
+ * var secondRepeat =
+ * container.findElement(by.repeater('contact in contacts').row(1));
+ *
+ * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+ * .toBe('408 555 1212');
+ * expect(secondRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+ * .toBe('john.smith@example.org');
+ *
+ * firstRepeat.findElement(by.linkText('clear')).click();
+ *
+ * expect(firstRepeat.findElement(by.model('contact.value')).getAttribute('value'))
+ * .toBe('');
+ *
+ * container.findElement(by.linkText('add')).click();
+ *
+ * expect(container.findElement(by.repeater('contact in contacts').row(2))
+ * .findElement(by.model('contact.value'))
+ * .getAttribute('value'))
+ * .toBe('yourname@example.org');
+ * });
+ *
+ *
*/
var ngControllerDirective = [function() {
@@ -17912,7 +18747,7 @@ var ngControllerDirective = [function() {
/**
* @ngdoc directive
- * @name ng.directive:ngCsp
+ * @name ngCsp
*
* @element html
* @description
@@ -17939,13 +18774,13 @@ var ngControllerDirective = [function() {
*
* @example
* This example shows how to apply the `ngCsp` directive to the `html` tag.
-
+ ```html
...
...
-
+ ```
*/
// ngCsp is not implemented as a proper directive any more, because we need it be processed while we bootstrap
@@ -17954,7 +18789,7 @@ var ngControllerDirective = [function() {
/**
* @ngdoc directive
- * @name ng.directive:ngClick
+ * @name ngClick
*
* @description
* The ngClick directive allows you to specify custom behavior when
@@ -17963,24 +18798,24 @@ var ngControllerDirective = [function() {
* @element ANY
* @priority 0
* @param {expression} ngClick {@link guide/expression Expression} to evaluate upon
- * click. (Event object is available as `$event`)
+ * click. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment
count: {{count}}
-
-
+
+
it('should check ng-click', function() {
expect(element(by.binding('count')).getText()).toMatch('0');
- element(by.css('.doc-example-live button')).click();
+ element(by.css('button')).click();
expect(element(by.binding('count')).getText()).toMatch('1');
});
-
-
+
+
*/
/*
* A directive that allows creation of custom onclick handlers that are defined as angular
@@ -18012,7 +18847,7 @@ forEach(
/**
* @ngdoc directive
- * @name ng.directive:ngDblclick
+ * @name ngDblclick
*
* @description
* The `ngDblclick` directive allows you to specify custom behavior on a dblclick event.
@@ -18023,20 +18858,20 @@ forEach(
* a dblclick. (The Event object is available as `$event`)
*
* @example
-
-
+
+
Increment (on double click)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngMousedown
+ * @name ngMousedown
*
* @description
* The ngMousedown directive allows you to specify custom behavior on mousedown event.
@@ -18044,23 +18879,23 @@ forEach(
* @element ANY
* @priority 0
* @param {expression} ngMousedown {@link guide/expression Expression} to evaluate upon
- * mousedown. (Event object is available as `$event`)
+ * mousedown. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment (on mouse down)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngMouseup
+ * @name ngMouseup
*
* @description
* Specify custom behavior on mouseup event.
@@ -18068,22 +18903,22 @@ forEach(
* @element ANY
* @priority 0
* @param {expression} ngMouseup {@link guide/expression Expression} to evaluate upon
- * mouseup. (Event object is available as `$event`)
+ * mouseup. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment (on mouse up)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngMouseover
+ * @name ngMouseover
*
* @description
* Specify custom behavior on mouseover event.
@@ -18091,23 +18926,23 @@ forEach(
* @element ANY
* @priority 0
* @param {expression} ngMouseover {@link guide/expression Expression} to evaluate upon
- * mouseover. (Event object is available as `$event`)
+ * mouseover. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment (when mouse is over)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngMouseenter
+ * @name ngMouseenter
*
* @description
* Specify custom behavior on mouseenter event.
@@ -18115,23 +18950,23 @@ forEach(
* @element ANY
* @priority 0
* @param {expression} ngMouseenter {@link guide/expression Expression} to evaluate upon
- * mouseenter. (Event object is available as `$event`)
+ * mouseenter. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment (when mouse enters)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngMouseleave
+ * @name ngMouseleave
*
* @description
* Specify custom behavior on mouseleave event.
@@ -18139,23 +18974,23 @@ forEach(
* @element ANY
* @priority 0
* @param {expression} ngMouseleave {@link guide/expression Expression} to evaluate upon
- * mouseleave. (Event object is available as `$event`)
+ * mouseleave. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment (when mouse leaves)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngMousemove
+ * @name ngMousemove
*
* @description
* Specify custom behavior on mousemove event.
@@ -18163,23 +18998,23 @@ forEach(
* @element ANY
* @priority 0
* @param {expression} ngMousemove {@link guide/expression Expression} to evaluate upon
- * mousemove. (Event object is available as `$event`)
+ * mousemove. ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Increment (when mouse moves)
count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngKeydown
+ * @name ngKeydown
*
* @description
* Specify custom behavior on keydown event.
@@ -18190,18 +19025,18 @@ forEach(
* keydown. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
-
-
+
+
key down count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngKeyup
+ * @name ngKeyup
*
* @description
* Specify custom behavior on keyup event.
@@ -18212,62 +19047,69 @@ forEach(
* keyup. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
*
* @example
-
-
-
- key up count: {{count}}
-
-
+
+
+ Typing in the input box below updates the key count
+ key up count: {{count}}
+
+ Typing in the input box below updates the keycode
+
+ event keyCode: {{ event.keyCode }}
+ event altKey: {{ event.altKey }}
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngKeypress
+ * @name ngKeypress
*
* @description
* Specify custom behavior on keypress event.
*
* @element ANY
* @param {expression} ngKeypress {@link guide/expression Expression} to evaluate upon
- * keypress. (Event object is available as `$event` and can be interrogated for keyCode, altKey, etc.)
+ * keypress. ({@link guide/expression#-event- Event object is available as `$event`}
+ * and can be interrogated for keyCode, altKey, etc.)
*
* @example
-
-
+
+
key press count: {{count}}
-
-
+
+
*/
/**
* @ngdoc directive
- * @name ng.directive:ngSubmit
+ * @name ngSubmit
*
* @description
* Enables binding angular expressions to onsubmit events.
*
* Additionally it prevents the default action (which for form means sending the request to the
- * server and reloading the current page) **but only if the form does not contain an `action`
- * attribute**.
+ * server and reloading the current page), but only if the form does not contain `action`,
+ * `data-action`, or `x-action` attributes.
*
* @element form
* @priority 0
- * @param {expression} ngSubmit {@link guide/expression Expression} to eval. (Event object is available as `$event`)
+ * @param {expression} ngSubmit {@link guide/expression Expression} to eval.
+ * ({@link guide/expression#-event- Event object is available as `$event`})
*
* @example
-
-
+
+
Load inlined template
-
-
+
+
it('should load template defined inside script tag', function() {
element(by.css('#tpl-link')).click();
expect(element(by.css('#tpl-content')).getText()).toMatch(/Content of the template/);
});
-
-
+
+
*/
var scriptDirective = ['$templateCache', function($templateCache) {
return {
@@ -20151,7 +21015,7 @@ var scriptDirective = ['$templateCache', function($templateCache) {
var ngOptionsMinErr = minErr('ngOptions');
/**
* @ngdoc directive
- * @name ng.directive:select
+ * @name select
* @restrict E
*
* @description
@@ -20169,7 +21033,7 @@ var ngOptionsMinErr = minErr('ngOptions');
*
*
* **Note:** `ngModel` compares by reference, not value. This is important when binding to an
- * array of objects. See an example {@link http://jsfiddle.net/qWzTb/ in this jsfiddle}.
+ * array of objects. See an example [in this jsfiddle](http://jsfiddle.net/qWzTb/).
*
*
* Optionally, a single hard-coded `` element, with the value set to an empty string, can
@@ -20220,8 +21084,8 @@ var ngOptionsMinErr = minErr('ngOptions');
* `value` variable (e.g. `value.propertyName`).
*
* @example
-
-
+
+
@@ -20246,40 +21110,40 @@ var ngOptionsMinErr = minErr('ngOptions');
Color (null not allowed):
-
+
Color (null allowed):
-
+
-- choose color --
Color grouped by shade:
-
+
- Select bogus .
+ Select bogus .
- Currently selected: {{ {selected_color:color} }}
+ Currently selected: {{ {selected_color:myColor} }}
+ ng-style="{'background-color':myColor.name}">
-
-
+
+
it('should check ng-options', function() {
- expect(element(by.binding('{selected_color:color}')).getText()).toMatch('red');
- element.all(by.select('color')).first().click();
- element.all(by.css('select[ng-model="color"] option')).first().click();
- expect(element(by.binding('{selected_color:color}')).getText()).toMatch('black');
- element(by.css('.nullable select[ng-model="color"]')).click();
- element.all(by.css('.nullable select[ng-model="color"] option')).first().click();
- expect(element(by.binding('{selected_color:color}')).getText()).toMatch('null');
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('red');
+ element.all(by.select('myColor')).first().click();
+ element.all(by.css('select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('black');
+ element(by.css('.nullable select[ng-model="myColor"]')).click();
+ element.all(by.css('.nullable select[ng-model="myColor"] option')).first().click();
+ expect(element(by.binding('{selected_color:myColor}')).getText()).toMatch('null');
});
-
-
+
+
*/
var ngOptionsDirective = valueFn({ terminal: true });
@@ -20431,7 +21295,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
// we need to work of an array, so we need to see if anything was inserted/removed
scope.$watch(function selectMultipleWatch() {
if (!equals(lastView, ctrl.$viewValue)) {
- lastView = copy(ctrl.$viewValue);
+ lastView = shallowCopy(ctrl.$viewValue);
ctrl.$render();
}
});
@@ -20452,7 +21316,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
function setupAsOptions(scope, selectElement, ctrl) {
var match;
- if (! (match = optionsExp.match(NG_OPTIONS_REGEXP))) {
+ if (!(match = optionsExp.match(NG_OPTIONS_REGEXP))) {
throw ngOptionsMinErr('iexp',
"Expected expression in form of " +
"'_select_ (as _label_)? for (_key_,)?_value_ in _collection_'" +
@@ -20542,6 +21406,12 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
value = valueFn(scope, locals);
}
}
+ // Update the null option's selected property here so $render cleans it up correctly
+ if (optionGroupsCache[0].length > 1) {
+ if (optionGroupsCache[0][1].id !== key) {
+ optionGroupsCache[0][1].selected = false;
+ }
+ }
}
ctrl.$setViewValue(value);
});
@@ -20679,7 +21549,7 @@ var selectDirective = ['$compile', '$parse', function($compile, $parse) {
lastElement.val(existingOption.id = option.id);
}
// lastElement.prop('selected') provided by jQuery has side-effects
- if (lastElement[0].selected !== option.selected) {
+ if (existingOption.selected !== option.selected) {
lastElement.prop('selected', (existingOption.selected = option.selected));
}
} else {
@@ -20783,6 +21653,12 @@ var styleDirective = valueFn({
terminal: true
});
+ if (window.angular.bootstrap) {
+ //AngularJS is already loaded, so we can return here...
+ console.log('WARNING: Tried to load angular more than once.');
+ return;
+ }
+
//try to bind to jquery now so that one can write angular.element().read()
//but we will rebind on bootstrap again.
bindJQuery();
@@ -20795,4 +21671,4 @@ var styleDirective = valueFn({
})(window, document);
-!angular.$$csp() && angular.element(document).find('head').prepend('');
\ No newline at end of file
+!window.angular.$$csp() && window.angular.element(document).find('head').prepend('');
\ No newline at end of file
diff --git a/config/lib/js/angular/angular.min.js b/config/lib/js/angular/angular.min.js
index 38df268a0e0..1c9d0748d89 100644
--- a/config/lib/js/angular/angular.min.js
+++ b/config/lib/js/angular/angular.min.js
@@ -1,202 +1,212 @@
/*
- AngularJS v1.2.12
+ AngularJS v1.2.17
(c) 2010-2014 Google, Inc. http://angularjs.org
License: MIT
*/
-(function(P,R,s){'use strict';function t(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.12/"+(b?b+"/":"")+a;for(c=1;c").append(b).html();try{return 3===b[0].nodeType?x(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,
-function(a,b){return"<"+x(b)})}catch(d){return x(c)}}function Ub(b){try{return decodeURIComponent(b)}catch(a){}}function Vb(b){var a={},c,d;q((b||"").split("&"),function(b){b&&(c=b.split("="),d=Ub(c[0]),D(d)&&(b=D(c[1])?Ub(c[1]):!0,a[d]?L(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Wb(b){var a=[];q(b,function(b,d){L(b)?q(b,function(b){a.push(va(d,!0)+(!0===b?"":"="+va(b,!0)))}):a.push(va(d,!0)+(!0===b?"":"="+va(b,!0)))});return a.length?a.join("&"):""}function sb(b){return va(b,
-!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function va(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Sc(b,a){function c(a){a&&d.push(a)}var d=[b],e,g,f=["ng:app","ng-app","x-ng-app","data-ng-app"],h=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;q(f,function(a){f[a]=!0;c(R.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(q(b.querySelectorAll("."+a),c),q(b.querySelectorAll("."+
-a+"\\:"),c),q(b.querySelectorAll("["+a+"]"),c))});q(d,function(a){if(!e){var b=h.exec(" "+a.className+" ");b?(e=a,g=(b[2]||"").replace(/\s+/g,",")):q(a.attributes,function(b){!e&&f[b.name]&&(e=a,g=b.value)})}});e&&a(e,g?[g]:[])}function Xb(b,a){var c=function(){b=z(b);if(b.injector()){var c=b[0]===R?"document":fa(b);throw Na("btstrpd",c);}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=Yb(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",
-function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(P&&!d.test(P.name))return c();P.name=P.name.replace(d,"");Ba.resumeBootstrap=function(b){q(b,function(b){a.push(b)});c()}}function cb(b,a){a=a||"_";return b.replace(Tc,function(b,d){return(d?a:"")+b.toLowerCase()})}function tb(b,a,c){if(!b)throw Na("areq",a||"?",c||"required");return b}function Pa(b,a,c){c&&L(b)&&(b=b[b.length-1]);tb(M(b),a,"not a function, got "+(b&&"object"==typeof b?
-b.constructor.name||"Object":typeof b));return b}function wa(b,a){if("hasOwnProperty"===b)throw Na("badname",a);}function Zb(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,g=a.length,f=0;f