code stringlengths 24 2.07M | docstring stringlengths 25 85.3k | func_name stringlengths 1 92 | language stringclasses 1
value | repo stringlengths 5 64 | path stringlengths 4 172 | url stringlengths 44 218 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
function TaskTracker(log) {
var self = this;
var taskCounts = {};
var taskCallbacks = [];
var ALL_TASKS_TYPE = self.ALL_TASKS_TYPE = '$$all$$';
var DEFAULT_TASK_TYPE = self.DEFAULT_TASK_TYPE = '$$default$$';
/**
* Execute the specified function and decrement the appropriate `taskCounts` counter.
* I... | ! This is a private undocumented service !
@name $$taskTrackerFactory
@description
A function to create `TaskTracker` instances.
A `TaskTracker` can keep track of pending tasks (grouped by type) and can notify interested
parties when all pending tasks (or tasks of a specific type) have been completed.
@param {$log} ... | TaskTracker | javascript | angular/angular.js | src/ng/taskTrackerFactory.js | https://github.com/angular/angular.js/blob/master/src/ng/taskTrackerFactory.js | MIT |
function $TemplateRequestProvider() {
var httpOptions;
/**
* @ngdoc method
* @name $templateRequestProvider#httpOptions
* @description
* The options to be passed to the {@link $http} service when making the request.
* You can use this to override options such as the "Accept" header for template req... | @ngdoc provider
@name $templateRequestProvider
@this
@description
Used to configure the options passed to the {@link $http} service when making a template request.
For example, it can be used for specifying the "Accept" header that is sent to the server, when
requesting a template. | $TemplateRequestProvider | javascript | angular/angular.js | src/ng/templateRequest.js | https://github.com/angular/angular.js/blob/master/src/ng/templateRequest.js | MIT |
function timeout(fn, delay, invokeApply) {
if (!isFunction(fn)) {
invokeApply = delay;
delay = fn;
fn = noop;
}
var args = sliceArgs(arguments, 3),
skipApply = (isDefined(invokeApply) && !invokeApply),
deferred = (skipApply ? $$q : $q).defer(),
pr... | @ngdoc service
@name $timeout
@description
AngularJS's wrapper for `window.setTimeout`. The `fn` function is wrapped into a try/catch
block and delegates any exceptions to
{@link ng.$exceptionHandler $exceptionHandler} service.
The return value of calling `$timeout` is a promise, which will be resolved when
the delay... | timeout | javascript | angular/angular.js | src/ng/timeout.js | https://github.com/angular/angular.js/blob/master/src/ng/timeout.js | MIT |
function urlIsSameOrigin(requestUrl) {
return urlsAreSameOrigin(requestUrl, originUrl);
} | Parse a request URL and determine whether this is a same-origin request as the application
document.
@param {string|object} requestUrl The url of the request as a string that will be resolved
or a parsed URL object.
@returns {boolean} Whether the request is for the same origin as the application document. | urlIsSameOrigin | javascript | angular/angular.js | src/ng/urlUtils.js | https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js | MIT |
function urlIsSameOriginAsBaseUrl(requestUrl) {
return urlsAreSameOrigin(requestUrl, getBaseUrl());
} | Parse a request URL and determine whether it is same-origin as the current document base URL.
Note: The base URL is usually the same as the document location (`location.href`) but can
be overriden by using the `<base>` tag.
@param {string|object} requestUrl The url of the request as a string that will be resolved
or ... | urlIsSameOriginAsBaseUrl | javascript | angular/angular.js | src/ng/urlUtils.js | https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js | MIT |
function urlIsAllowedOriginFactory(trustedOriginUrls) {
var parsedAllowedOriginUrls = [originUrl].concat(trustedOriginUrls.map(urlResolve));
/**
* Check whether the specified URL (string or parsed URL object) has an origin that is allowed
* based on a list of trusted-origin URLs. The current location's origi... | Create a function that can check a URL's origin against a list of allowed/trusted origins.
The current location's origin is implicitly trusted.
@param {string[]} trustedOriginUrls - A list of URLs (strings), whose origins are trusted.
@returns {Function} - A function that receives a URL (string or parsed URL object) ... | urlIsAllowedOriginFactory | javascript | angular/angular.js | src/ng/urlUtils.js | https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js | MIT |
function urlsAreSameOrigin(url1, url2) {
url1 = urlResolve(url1);
url2 = urlResolve(url2);
return (url1.protocol === url2.protocol &&
url1.host === url2.host);
} | Determine if two URLs share the same origin.
@param {string|Object} url1 - First URL to compare as a string or a normalized URL in the form of
a dictionary object returned by `urlResolve()`.
@param {string|object} url2 - Second URL to compare as a string or a normalized URL in the form
of a dictionary object r... | urlsAreSameOrigin | javascript | angular/angular.js | src/ng/urlUtils.js | https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js | MIT |
function getBaseUrl() {
if (window.document.baseURI) {
return window.document.baseURI;
}
// `document.baseURI` is available everywhere except IE
if (!baseUrlParsingNode) {
baseUrlParsingNode = window.document.createElement('a');
baseUrlParsingNode.href = '.';
// Work-around for IE bug describe... | Returns the current document base URL.
@returns {string} | getBaseUrl | javascript | angular/angular.js | src/ng/urlUtils.js | https://github.com/angular/angular.js/blob/master/src/ng/urlUtils.js | MIT |
function $WindowProvider() {
this.$get = valueFn(window);
} | @ngdoc service
@name $window
@this
@description
A reference to the browser's `window` object. While `window`
is globally available in JavaScript, it causes testability problems, because
it is a global variable. In AngularJS we always refer to it through the
`$window` service, so it may be overridden, removed or mocked... | $WindowProvider | javascript | angular/angular.js | src/ng/window.js | https://github.com/angular/angular.js/blob/master/src/ng/window.js | MIT |
function defaultLinkFn(scope, element, attr) {
scope.$watch(attr[normalized], function ngBooleanAttrWatchAction(value) {
attr.$set(attrName, !!value);
});
} | @ngdoc directive
@name ngOpen
@restrict A
@priority 100
@description
Sets the `open` attribute on the element, if the expression inside `ngOpen` is truthy.
A special directive is necessary because we cannot use interpolation inside the `open`
attribute. See the {@link guide/interpolation interpolation guide} for mor... | defaultLinkFn | javascript | angular/angular.js | src/ng/directive/attrs.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/attrs.js | MIT |
function stringBasedInputType(ctrl) {
ctrl.$formatters.push(function(value) {
return ctrl.$isEmpty(value) ? value : value.toString();
});
} | @ngdoc input
@name input[checkbox]
@description
HTML checkbox.
@param {string} ngModel Assignable AngularJS expression to data-bind to.
@param {string=} name Property name of the form under which the control is published.
@param {expression=} ngTrueValue The value to which the expression should be set when selected.
... | stringBasedInputType | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
function textInputType(scope, element, attr, ctrl, $sniffer, $browser) {
baseInputType(scope, element, attr, ctrl, $sniffer, $browser);
stringBasedInputType(ctrl);
} | @ngdoc input
@name input[checkbox]
@description
HTML checkbox.
@param {string} ngModel Assignable AngularJS expression to data-bind to.
@param {string=} name Property name of the form under which the control is published.
@param {expression=} ngTrueValue The value to which the expression should be set when selected.
... | textInputType | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
function baseInputType(scope, element, attr, ctrl, $sniffer, $browser) {
var type = lowercase(element[0].type);
// In composition mode, users are still inputting intermediate text buffer,
// hold the listener until composition is done.
// More about composition events: https://developer.mozilla.org/en-US/docs/... | @ngdoc input
@name input[checkbox]
@description
HTML checkbox.
@param {string} ngModel Assignable AngularJS expression to data-bind to.
@param {string=} name Property name of the form under which the control is published.
@param {expression=} ngTrueValue The value to which the expression should be set when selected.
... | baseInputType | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
listener = function(ev) {
if (timeout) {
$browser.defer.cancel(timeout);
timeout = null;
}
if (composing) return;
var value = element.val(),
event = ev && ev.type;
// By default we will trim the value
// If the attribute ng-trim exists we will avoid trimming
// If input ... | @ngdoc input
@name input[checkbox]
@description
HTML checkbox.
@param {string} ngModel Assignable AngularJS expression to data-bind to.
@param {string=} name Property name of the form under which the control is published.
@param {expression=} ngTrueValue The value to which the expression should be set when selected.
... | listener | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
deferListener = function(ev, input, origValue) {
if (!timeout) {
timeout = $browser.defer(function() {
timeout = null;
if (!input || input.value !== origValue) {
listener(ev);
}
});
}
} | @ngdoc input
@name input[checkbox]
@description
HTML checkbox.
@param {string} ngModel Assignable AngularJS expression to data-bind to.
@param {string=} name Property name of the form under which the control is published.
@param {expression=} ngTrueValue The value to which the expression should be set when selected.
... | deferListener | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
hiddenInputBrowserCacheDirective = function() {
var valueProperty = {
configurable: true,
enumerable: false,
get: function() {
return this.getAttribute('value') || '';
},
set: function(val) {
this.setAttribute('value', val);
}
};
return {
restrict: 'E',
priority: 200,
... | @ngdoc directive
@name input
@restrict E
@description
HTML input element control. When used together with {@link ngModel `ngModel`}, it provides data-binding,
input state control, and validation.
Input control follows HTML5 input types and polyfills the HTML5 validation behavior for older browsers.
<div class="alert ... | hiddenInputBrowserCacheDirective | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
ngValueDirective = function() {
/**
* inputs use the value attribute as their default value if the value property is not set.
* Once the value property has been set (by adding input), it will not react to changes to
* the value attribute anymore. Setting both attribute and property fixes this behavior, an... | @ngdoc directive
@name ngValue
@restrict A
@priority 100
@description
Binds the given expression to the value of the element.
It is mainly used on {@link input[radio] `input[radio]`} and option elements,
so that when the element is selected, the {@link ngModel `ngModel`} of that element (or its
{@link select `select`... | ngValueDirective | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
function updateElementValue(element, attr, value) {
// Support: IE9 only
// In IE9 values are converted to string (e.g. `input.value = null` results in `input.value === 'null'`).
var propValue = isDefined(value) ? value : (msie === 9) ? '' : null;
element.prop('value', propValue);
attr.$set('value',... | inputs use the value attribute as their default value if the value property is not set.
Once the value property has been set (by adding input), it will not react to changes to
the value attribute anymore. Setting both attribute and property fixes this behavior, and
makes it possible to use ngValue as a sort of one-w... | updateElementValue | javascript | angular/angular.js | src/ng/directive/input.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/input.js | MIT |
function createEventDirective($parse, $rootScope, $exceptionHandler, directiveName, eventName, forceAsync) {
return {
restrict: 'A',
compile: function($element, attr) {
// NOTE:
// We expose the powerful `$event` object on the scope that provides access to the Window,
// etc. This is OK, bec... | @ngdoc directive
@name ngClick
@restrict A
@element ANY
@priority 0
@description
The ngClick directive allows you to specify custom behavior when
an element is clicked.
@param {expression} ngClick {@link guide/expression Expression} to evaluate upon
click. ({@link guide/expression#-event- Event object is available as... | createEventDirective | javascript | angular/angular.js | src/ng/directive/ngEventDirs.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngEventDirs.js | MIT |
callback = function() {
fn(scope, {$event: event});
} | @ngdoc directive
@name ngClick
@restrict A
@element ANY
@priority 0
@description
The ngClick directive allows you to specify custom behavior when
an element is clicked.
@param {expression} ngClick {@link guide/expression Expression} to evaluate upon
click. ({@link guide/expression#-event- Event object is available as... | callback | javascript | angular/angular.js | src/ng/directive/ngEventDirs.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngEventDirs.js | MIT |
function NgModelController($scope, $exceptionHandler, $attr, $element, $parse, $animate, $timeout, $q, $interpolate) {
this.$viewValue = Number.NaN;
this.$modelValue = Number.NaN;
this.$$rawModelValue = undefined; // stores the parsed modelValue / model set from scope regardless of validity.
this.$validators = ... | @ngdoc type
@name ngModel.NgModelController
@property {*} $viewValue The actual value from the control's view. For `input` elements, this is a
String. See {@link ngModel.NgModelController#$setViewValue} for information about when the $viewValue
is set.
@property {*} $modelValue The value in the model that the control ... | NgModelController | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function processParseErrors() {
var errorKey = that.$$parserName;
if (isUndefined(that.$$parserValid)) {
setValidity(errorKey, null);
} else {
if (!that.$$parserValid) {
forEach(that.$validators, function(v, name) {
setValidity(name, null);
});
... | @ngdoc method
@name ngModel.NgModelController#$validate
@description
Runs each of the registered validators (first synchronous validators and then
asynchronous validators).
If the validity changes to invalid, the model will be set to `undefined`,
unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
I... | processParseErrors | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function processSyncValidators() {
var syncValidatorsValid = true;
forEach(that.$validators, function(validator, name) {
var result = Boolean(validator(modelValue, viewValue));
syncValidatorsValid = syncValidatorsValid && result;
setValidity(name, result);
});
if (!syncVa... | @ngdoc method
@name ngModel.NgModelController#$validate
@description
Runs each of the registered validators (first synchronous validators and then
asynchronous validators).
If the validity changes to invalid, the model will be set to `undefined`,
unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
I... | processSyncValidators | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function processAsyncValidators() {
var validatorPromises = [];
var allValid = true;
forEach(that.$asyncValidators, function(validator, name) {
var promise = validator(modelValue, viewValue);
if (!isPromiseLike(promise)) {
throw ngModelMinErr('nopromise',
'Expecte... | @ngdoc method
@name ngModel.NgModelController#$validate
@description
Runs each of the registered validators (first synchronous validators and then
asynchronous validators).
If the validity changes to invalid, the model will be set to `undefined`,
unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
I... | processAsyncValidators | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function setValidity(name, isValid) {
if (localValidationRunId === that.$$currentValidationRunId) {
that.$setValidity(name, isValid);
}
} | @ngdoc method
@name ngModel.NgModelController#$validate
@description
Runs each of the registered validators (first synchronous validators and then
asynchronous validators).
If the validity changes to invalid, the model will be set to `undefined`,
unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
I... | setValidity | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function validationDone(allValid) {
if (localValidationRunId === that.$$currentValidationRunId) {
doneCallback(allValid);
}
} | @ngdoc method
@name ngModel.NgModelController#$validate
@description
Runs each of the registered validators (first synchronous validators and then
asynchronous validators).
If the validity changes to invalid, the model will be set to `undefined`,
unless {@link ngModelOptions `ngModelOptions.allowInvalid`} is `true`.
I... | validationDone | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function setupModelWatcher(ctrl) {
// model -> value
// Note: we cannot use a normal scope.$watch as we want to detect the following:
// 1. scope value is 'a'
// 2. user enters 'b'
// 3. ng-change kicks in and reverts scope value to 'a'
// -> scope value did not change since the last digest as
// ... | This method is called internally when the bound scope value changes. | setupModelWatcher | javascript | angular/angular.js | src/ng/directive/ngModel.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModel.js | MIT |
function ModelOptions(options) {
this.$$options = options;
} | @ngdoc type
@name ModelOptions
@description
A container for the options set by the {@link ngModelOptions} directive | ModelOptions | javascript | angular/angular.js | src/ng/directive/ngModelOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngModelOptions.js | MIT |
function parseOptionsExpression(optionsExp, selectElement, scope) {
var match = optionsExp.match(NG_OPTIONS_REGEXP);
if (!(match)) {
throw ngOptionsMinErr('iexp',
'Expected expression in form of ' +
'\'_select_ (as _label_)? for (_key_,)?_value_ in _collection_\'' +
' but got \'{0... | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | parseOptionsExpression | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
getTrackByValue = function(value, key) {
return getTrackByValueFn(value, getLocals(value, key));
} | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | getTrackByValue | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function Option(selectValue, viewValue, label, group, disabled) {
this.selectValue = selectValue;
this.viewValue = viewValue;
this.label = label;
this.group = group;
this.disabled = disabled;
} | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | Option | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function getOptionValuesKeys(optionValues) {
var optionValuesKeys;
if (!keyName && isArrayLike(optionValues)) {
optionValuesKeys = optionValues;
} else {
// if object, extract keys, in enumeration order, unsorted
optionValuesKeys = [];
for (var itemKey in optionValues)... | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | getOptionValuesKeys | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function ngOptionsPostLink(scope, selectElement, attr, ctrls) {
var selectCtrl = ctrls[0];
var ngModelCtrl = ctrls[1];
var multiple = attr.multiple;
// The emptyOption allows the application developer to provide their own custom "empty"
// option when the viewValue does not match any of ... | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | ngOptionsPostLink | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function addOptionElement(option, parent) {
var optionElement = optionTemplate.cloneNode(false);
parent.appendChild(optionElement);
updateOptionElement(option, optionElement);
} | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | addOptionElement | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function getAndUpdateSelectedOption(viewValue) {
var option = options.getOptionFromViewValue(viewValue);
var element = option && option.element;
if (element && !element.selected) element.selected = true;
return option;
} | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | getAndUpdateSelectedOption | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function updateOptionElement(option, element) {
option.element = element;
element.disabled = option.disabled;
// Support: IE 11 only, Edge 12-13 only
// NOTE: The label must be set before the value, otherwise IE 11 & Edge create unresponsive
// selects in certain circumstances wh... | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | updateOptionElement | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
function updateOptions() {
var previousValue = options && selectCtrl.readValue();
// We must remove all current options, but cannot simply set innerHTML = null
// since the providedEmptyOption might have an ngIf on it that inserts comments which we
// must preserve.
// Instead, ... | @ngdoc directive
@name ngOptions
@restrict A
@description
The `ngOptions` attribute can be used to dynamically generate a list of `<option>`
elements for the `<select>` element using the array or object obtained by evaluating the
`ngOptions` comprehension expression.
In many cases, {@link ng.directive:ngRepeat ngRep... | updateOptions | javascript | angular/angular.js | src/ng/directive/ngOptions.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngOptions.js | MIT |
spliceFactory = function(array, index) {
return function(response) {
if (response !== false) array.splice(index, 1);
};
} | @ngdoc directive
@name ngSwitch
@restrict EA
@description
The `ngSwitch` directive is used to conditionally swap DOM structure on your template based on a scope expression.
Elements within `ngSwitch` but without `ngSwitchWhen` or `ngSwitchDefault` directives will be preserved at the location
as specified in the templa... | spliceFactory | javascript | angular/angular.js | src/ng/directive/ngSwitch.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngSwitch.js | MIT |
function ngTranscludeCloneAttachFn(clone, transcludedScope) {
if (clone.length && notWhitespace(clone)) {
$element.append(clone);
} else {
useFallbackContent();
// There is nothing linked against the transcluded scope since no content was available,
//... | @ngdoc directive
@name ngTransclude
@restrict EAC
@description
Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
as the valu... | ngTranscludeCloneAttachFn | javascript | angular/angular.js | src/ng/directive/ngTransclude.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngTransclude.js | MIT |
function useFallbackContent() {
// Since this is the fallback content rather than the transcluded content,
// we link against the scope of this directive rather than the transcluded scope
fallbackLinkFn($scope, function(clone) {
$element.append(clone);
});
} | @ngdoc directive
@name ngTransclude
@restrict EAC
@description
Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
as the valu... | useFallbackContent | javascript | angular/angular.js | src/ng/directive/ngTransclude.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngTransclude.js | MIT |
function notWhitespace(nodes) {
for (var i = 0, ii = nodes.length; i < ii; i++) {
var node = nodes[i];
if (node.nodeType !== NODE_TYPE_TEXT || node.nodeValue.trim()) {
return true;
}
}
} | @ngdoc directive
@name ngTransclude
@restrict EAC
@description
Directive that marks the insertion point for the transcluded DOM of the nearest parent directive that uses transclusion.
You can specify that you want to insert a named transclusion slot, instead of the default slot, by providing the slot name
as the valu... | notWhitespace | javascript | angular/angular.js | src/ng/directive/ngTransclude.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/ngTransclude.js | MIT |
function scheduleRender() {
if (renderScheduled) return;
renderScheduled = true;
$scope.$$postDigest(function() {
renderScheduled = false;
self.ngModelCtrl.$render();
});
} | @ngdoc method
@name select.SelectController#$isEmptyOptionSelected
@description
Returns `true` if the select element has an empty option and this empty option is currently
selected. Returns `false` if the select element has no empty option or it is not selected. | scheduleRender | javascript | angular/angular.js | src/ng/directive/select.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/select.js | MIT |
function scheduleViewValueUpdate(renderAfter) {
if (updateScheduled) return;
updateScheduled = true;
$scope.$$postDigest(function() {
if ($scope.$$destroyed) return;
updateScheduled = false;
self.ngModelCtrl.$setViewValue(self.readValue());
if (renderAfter) self.ngModelCtrl.$rende... | @ngdoc method
@name select.SelectController#$isEmptyOptionSelected
@description
Returns `true` if the select element has an empty option and this empty option is currently
selected. Returns `false` if the select element has no empty option or it is not selected. | scheduleViewValueUpdate | javascript | angular/angular.js | src/ng/directive/select.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/select.js | MIT |
selectDirective = function() {
return {
restrict: 'E',
require: ['select', '?ngModel'],
controller: SelectController,
priority: 1,
link: {
pre: selectPreLink,
post: selectPostLink
}
};
function selectPreLink(scope, element, attr, ctrls) {
var selectCtrl = ctrls[0];
... | @ngdoc directive
@name select
@restrict E
@description
HTML `select` element with AngularJS data-binding.
The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
between the scope and the `<select>` control (including setting default values).
It also handles dynamic `<option>` e... | selectDirective | javascript | angular/angular.js | src/ng/directive/select.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/select.js | MIT |
function selectPreLink(scope, element, attr, ctrls) {
var selectCtrl = ctrls[0];
var ngModelCtrl = ctrls[1];
// if ngModel is not defined, we don't need to do anything but set the registerOption
// function to noop, so options don't get added internally
if (!ngModelCtrl) {
select... | @ngdoc directive
@name select
@restrict E
@description
HTML `select` element with AngularJS data-binding.
The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
between the scope and the `<select>` control (including setting default values).
It also handles dynamic `<option>` e... | selectPreLink | javascript | angular/angular.js | src/ng/directive/select.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/select.js | MIT |
function selectPostLink(scope, element, attrs, ctrls) {
// if ngModel is not defined, we don't need to do anything
var ngModelCtrl = ctrls[1];
if (!ngModelCtrl) return;
var selectCtrl = ctrls[0];
// We delegate rendering to the `writeValue` method, which can be changed
// if the se... | @ngdoc directive
@name select
@restrict E
@description
HTML `select` element with AngularJS data-binding.
The `select` directive is used together with {@link ngModel `ngModel`} to provide data-binding
between the scope and the `<select>` control (including setting default values).
It also handles dynamic `<option>` e... | selectPostLink | javascript | angular/angular.js | src/ng/directive/select.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/select.js | MIT |
function parsePatternAttr(regex, patternExp, elm) {
if (!regex) return undefined;
if (isString(regex)) {
regex = new RegExp('^' + regex + '$');
}
if (!regex.test) {
throw minErr('ngPattern')('noregexp',
'Expected {0} to be a RegExp but was {1}. Element: {2}', patternExp,
regex, startingTag... | @ngdoc directive
@name ngMinlength
@restrict A
@param {expression} ngMinlength AngularJS expression that must evaluate to a `Number` or `String`
parsable into a `Number`. Used as value for the `minlength`
{@link ngModel.NgModelController#$validators valid... | parsePatternAttr | javascript | angular/angular.js | src/ng/directive/validators.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/validators.js | MIT |
function parseLength(val) {
var intVal = toInt(val);
return isNumberNaN(intVal) ? -1 : intVal;
} | @ngdoc directive
@name ngMinlength
@restrict A
@param {expression} ngMinlength AngularJS expression that must evaluate to a `Number` or `String`
parsable into a `Number`. Used as value for the `minlength`
{@link ngModel.NgModelController#$validators valid... | parseLength | javascript | angular/angular.js | src/ng/directive/validators.js | https://github.com/angular/angular.js/blob/master/src/ng/directive/validators.js | MIT |
function currencyFilter($locale) {
var formats = $locale.NUMBER_FORMATS;
return function(amount, currencySymbol, fractionSize) {
if (isUndefined(currencySymbol)) {
currencySymbol = formats.CURRENCY_SYM;
}
if (isUndefined(fractionSize)) {
fractionSize = formats.PATTERNS[1].maxFrac;
}
... | @ngdoc filter
@name currency
@kind function
@description
Formats a number as a currency (ie $1,234.56). When no currency symbol is provided, default
symbol for current locale is used.
@param {number} amount Input to filter.
@param {string=} symbol Currency symbol or identifier to be displayed.
@param {number=} fracti... | currencyFilter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function parse(numStr) {
var exponent = 0, digits, numberOfIntegerDigits;
var i, j, zeros;
// Decimal point?
if ((numberOfIntegerDigits = numStr.indexOf(DECIMAL_SEP)) > -1) {
numStr = numStr.replace(DECIMAL_SEP, '');
}
// Exponential form?
if ((i = numStr.search(/e/i)) > 0) {
// Work out the exp... | Parse a number (as a string) into three components that can be used
for formatting the number.
(Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/)
@param {string} numStr The number to parse
@return {object} An object describing this number, containing the following keys:
- d : an... | parse | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function roundNumber(parsedNumber, fractionSize, minFrac, maxFrac) {
var digits = parsedNumber.d;
var fractionLen = digits.length - parsedNumber.i;
// determine fractionSize if it is not specified; `+fractionSize` converts it to a number
fractionSize = (isUndefined(fractionSize)) ? Math.min(Math.max(mi... | Round the parsed number to the specified number of decimal places
This function changed the parsedNumber in-place | roundNumber | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function formatNumber(number, pattern, groupSep, decimalSep, fractionSize) {
if (!(isString(number) || isNumber(number)) || isNaN(number)) return '';
var isInfinity = !isFinite(number);
var isZero = false;
var numStr = Math.abs(number) + '',
formattedText = '',
parsedNumber;
if (isInfinity) {
... | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | formatNumber | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function padNumber(num, digits, trim, negWrap) {
var neg = '';
if (num < 0 || (negWrap && num <= 0)) {
if (negWrap) {
num = -num + 1;
} else {
num = -num;
neg = '-';
}
}
num = '' + num;
while (num.length < digits) num = ZERO_CHAR + num;
if (trim) {
num = num.substr(num.leng... | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | padNumber | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function dateGetter(name, size, offset, trim, negWrap) {
offset = offset || 0;
return function(date) {
var value = date['get' + name]();
if (offset > 0 || value > -offset) {
value += offset;
}
if (value === 0 && offset === -12) value = 12;
return padNumber(value, size, trim, negWrap);
};... | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | dateGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function dateStrGetter(name, shortForm, standAlone) {
return function(date, formats) {
var value = date['get' + name]();
var propPrefix = (standAlone ? 'STANDALONE' : '') + (shortForm ? 'SHORT' : '');
var get = uppercase(propPrefix + name);
return formats[get][value];
};
} | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | dateStrGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function timeZoneGetter(date, formats, offset) {
var zone = -1 * offset;
var paddedZone = (zone >= 0) ? '+' : '';
paddedZone += padNumber(Math[zone > 0 ? 'floor' : 'ceil'](zone / 60), 2) +
padNumber(Math.abs(zone % 60), 2);
return paddedZone;
} | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | timeZoneGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function getFirstThursdayOfYear(year) {
// 0 = index of January
var dayOfWeekOnFirst = (new Date(year, 0, 1)).getDay();
// 4 = index of Thursday (+1 to account for 1st = 5)
// 11 = index of *next* Thursday (+1 account for 1st = 12)
return new Date(year, 0, ((dayOfWeekOnFirst <= 4) ? 5 : 12) - dayOfW... | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | getFirstThursdayOfYear | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function getThursdayThisWeek(datetime) {
return new Date(datetime.getFullYear(), datetime.getMonth(),
// 4 = index of Thursday
datetime.getDate() + (4 - datetime.getDay()));
} | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | getThursdayThisWeek | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function weekGetter(size) {
return function(date) {
var firstThurs = getFirstThursdayOfYear(date.getFullYear()),
thisThurs = getThursdayThisWeek(date);
var diff = +thisThurs - +firstThurs,
result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
return padNumber(result, s... | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | weekGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function ampmGetter(date, formats) {
return date.getHours() < 12 ? formats.AMPMS[0] : formats.AMPMS[1];
} | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | ampmGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function eraGetter(date, formats) {
return date.getFullYear() <= 0 ? formats.ERAS[0] : formats.ERAS[1];
} | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | eraGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function longEraGetter(date, formats) {
return date.getFullYear() <= 0 ? formats.ERANAMES[0] : formats.ERANAMES[1];
} | Format a number into a string
@param {number} number The number to format
@param {{
minFrac, // the minimum number of digits required in the fraction part of the number
maxFrac, // the maximum number of digits required in the fraction part of the number
gSize, // number of digits... | longEraGetter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function dateFilter($locale) {
var R_ISO8601_STR = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
// 1 2 3 4 5 6 7 8 9 10 11
function jsonStringToDate(string) {
var ... | @ngdoc filter
@name date
@kind function
@description
Formats `date` to a string based on the requested `format`.
`format` string can be composed of the following elements:
* `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
* `'yy'`: 2 digit representation of year, padded (00-99).... | dateFilter | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function jsonStringToDate(string) {
var match;
if ((match = string.match(R_ISO8601_STR))) {
var date = new Date(0),
tzHour = 0,
tzMin = 0,
dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear,
timeSetter = match[8] ? date.setUTCHours : date.setHours;
... | @ngdoc filter
@name date
@kind function
@description
Formats `date` to a string based on the requested `format`.
`format` string can be composed of the following elements:
* `'yyyy'`: 4 digit representation of year (e.g. AD 1 => 0001, AD 2010 => 2010)
* `'yy'`: 2 digit representation of year, padded (00-99).... | jsonStringToDate | javascript | angular/angular.js | src/ng/filter/filters.js | https://github.com/angular/angular.js/blob/master/src/ng/filter/filters.js | MIT |
function setData(value) {
value = value === 'on' || value === 'true';
element.data(NG_ANIMATE_CHILDREN_DATA, value);
} | @ngdoc directive
@name ngAnimateChildren
@restrict AE
@element ANY
@description
ngAnimateChildren allows you to specify that children of this element should animate even if any
of the children's parents are currently animating. By default, when an element has an active `enter`, `leave`, or `move`
(structural) animati... | setData | javascript | angular/angular.js | src/ngAnimate/animateChildrenDirective.js | https://github.com/angular/angular.js/blob/master/src/ngAnimate/animateChildrenDirective.js | MIT |
function areAnimationsAllowed(node, parentNode, event) {
var bodyNode = $document[0].body;
var rootNode = getDomNode($rootElement);
var bodyNodeDetected = (node === bodyNode) || node.nodeName === 'HTML';
var rootNodeDetected = (node === rootNode);
var parentAnimationDetected = false;
... | This fn returns false if any of the following is true:
a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed
b) a parent element has an ongoing structural animation, and animateChildren is false
c) the element is not a child of the body
d) the element is not a child o... | areAnimationsAllowed | javascript | angular/angular.js | src/ngAnimate/animateQueue.js | https://github.com/angular/angular.js/blob/master/src/ngAnimate/animateQueue.js | MIT |
function markElementAnimationState(node, state, details) {
details = details || {};
details.state = state;
node.setAttribute(NG_ANIMATE_ATTR_NAME, state);
var oldValue = activeAnimationsLookup.get(node);
var newValue = oldValue
? extend(oldValue, details)
: details;
... | This fn returns false if any of the following is true:
a) animations on any parent element are disabled, and animations on the element aren't explicitly allowed
b) a parent element has an ongoing structural animation, and animateChildren is false
c) the element is not a child of the body
d) the element is not a child o... | markElementAnimationState | javascript | angular/angular.js | src/ngAnimate/animateQueue.js | https://github.com/angular/angular.js/blob/master/src/ngAnimate/animateQueue.js | MIT |
function shouldAttachAttr(attr, normalizedAttr, elem, allowNonAriaNodes) {
return $aria.config(normalizedAttr) &&
!elem.attr(attr) &&
(allowNonAriaNodes || !isNodeOneOf(elem, nativeAriaNodeNames)) &&
(elem.attr('type') !== 'hidden' || elem[0].nodeName !== 'INPUT');
} | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | shouldAttachAttr | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function shouldAttachRole(role, elem) {
// if element does not have role attribute
// AND element type is equal to role (if custom element has a type equaling shape) <-- remove?
// AND element is not in nativeAriaNodeNames
return !elem.attr('role') && (elem.attr('type') === role) && !isNodeOneOf(elem, n... | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | shouldAttachRole | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function getShape(attr, elem) {
var type = attr.type,
role = attr.role;
return ((type || role) === 'checkbox' || role === 'menuitemcheckbox') ? 'checkbox' :
((type || role) === 'radio' || role === 'menuitemradio') ? 'radio' :
(type === 'range' || role === 'progress... | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | getShape | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function ngAriaWatchModelValue() {
return ngModel.$modelValue;
} | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | ngAriaWatchModelValue | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function getRadioReaction(newVal) {
// Strict comparison would cause a BC
// eslint-disable-next-line eqeqeq
var boolVal = (attr.value == ngModel.$viewValue);
elem.attr('aria-checked', boolVal);
} | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | getRadioReaction | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function getCheckboxReaction() {
elem.attr('aria-checked', !ngModel.$isEmpty(ngModel.$viewValue));
} | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | getCheckboxReaction | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function callback() {
fn(scope, { $event: event });
} | @ngdoc service
@name $aria
@description
The $aria service contains helper methods for applying common
[ARIA](http://www.w3.org/TR/wai-aria/) attributes to HTML directives.
ngAria injects common accessibility attributes that tell assistive technologies when HTML
elements are enabled, selected, hidden, and more. To se... | callback | javascript | angular/angular.js | src/ngAria/aria.js | https://github.com/angular/angular.js/blob/master/src/ngAria/aria.js | MIT |
function calcOptions(options) {
return options ? angular.extend({}, defaults, options) : defaults;
} | @ngdoc property
@name $cookiesProvider#defaults
@description
Object containing default options to pass when setting cookies.
The object may have following properties:
- **path** - `{string}` - The cookie will be available only for this path and its
sub-paths. By default, this is the URL that appears in your `<base... | calcOptions | javascript | angular/angular.js | src/ngCookies/cookies.js | https://github.com/angular/angular.js/blob/master/src/ngCookies/cookies.js | MIT |
function $$CookieWriter($document, $log, $browser) {
var cookiePath = $browser.baseHref();
var rawDocument = $document[0];
function buildCookieString(name, value, options) {
var path, expires;
options = options || {};
expires = options.expires;
path = angular.isDefined(options.path) ? options.pat... | @name $$cookieWriter
@requires $document
@description
This is a private service for writing cookies
@param {string} name Cookie name
@param {string=} value Cookie value (if undefined, cookie will be deleted)
@param {Object=} options Object with options that need to be stored for the cookie. | $$CookieWriter | javascript | angular/angular.js | src/ngCookies/cookieWriter.js | https://github.com/angular/angular.js/blob/master/src/ngCookies/cookieWriter.js | MIT |
function buildCookieString(name, value, options) {
var path, expires;
options = options || {};
expires = options.expires;
path = angular.isDefined(options.path) ? options.path : cookiePath;
if (angular.isUndefined(value)) {
expires = 'Thu, 01 Jan 1970 00:00:00 GMT';
value = '';
}
... | @name $$cookieWriter
@requires $document
@description
This is a private service for writing cookies
@param {string} name Cookie name
@param {string=} value Cookie value (if undefined, cookie will be deleted)
@param {Object=} options Object with options that need to be stored for the cookie. | buildCookieString | javascript | angular/angular.js | src/ngCookies/cookieWriter.js | https://github.com/angular/angular.js/blob/master/src/ngCookies/cookieWriter.js | MIT |
function getStringifier(trustedContext, allOrNothing, text) {
return function stringifier(value) {
try {
value = trustedContext ? $sce['getTrusted'](trustedContext, value) : $sce['valueOf'](value);
return allOrNothing && (value === undefined) ? value : $$stringify(value);
} catch (err) {... | @ngdoc module
@name ngMessageFormat
@packageName angular-message-format
@description
## What is ngMessageFormat?
The ngMessageFormat module extends the AngularJS {@link ng.$interpolate `$interpolate`} service
with a syntax for handling pluralization and gender specific messages, which is based on the
[ICU MessageFo... | getStringifier | javascript | angular/angular.js | src/ngMessageFormat/messageFormatService.js | https://github.com/angular/angular.js/blob/master/src/ngMessageFormat/messageFormatService.js | MIT |
function interpolate(text, mustHaveExpression, trustedContext, allOrNothing) {
var stringifier = getStringifier(trustedContext, allOrNothing, text);
var parser = new MessageFormatParser(text, 0, $parse, $locale['pluralCat'], stringifier,
mustHaveExpression, trustedContex... | @ngdoc module
@name ngMessageFormat
@packageName angular-message-format
@description
## What is ngMessageFormat?
The ngMessageFormat module extends the AngularJS {@link ng.$interpolate `$interpolate`} service
with a syntax for handling pluralization and gender specific messages, which is based on the
[ICU MessageFo... | interpolate | javascript | angular/angular.js | src/ngMessageFormat/messageFormatService.js | https://github.com/angular/angular.js/blob/master/src/ngMessageFormat/messageFormatService.js | MIT |
function findPreviousMessage(parent, comment) {
var prevNode = comment;
var parentLookup = [];
while (prevNode && prevNode !== parent) {
var prevKey = prevNode.$$ngMessageNode;
if (prevKey && prevKey.length) {
return messages[prevKey];
}
... | @ngdoc directive
@module ngMessages
@name ngMessages
@restrict AE
@description
`ngMessages` is a directive that is designed to show and hide messages based on the state
of a key/value object that it listens on. The directive itself complements error message
reporting with the `ngModel` $error object (which stores a ke... | findPreviousMessage | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function insertMessageNode(parent, comment, key) {
var messageNode = messages[key];
if (!ctrl.head) {
ctrl.head = messageNode;
} else {
var match = findPreviousMessage(parent, comment);
if (match) {
messageNode.next = match.next;
... | @ngdoc directive
@module ngMessages
@name ngMessages
@restrict AE
@description
`ngMessages` is a directive that is designed to show and hide messages based on the state
of a key/value object that it listens on. The directive itself complements error message
reporting with the `ngModel` $error object (which stores a ke... | insertMessageNode | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function removeMessageNode(parent, comment, key) {
var messageNode = messages[key];
// This message node may have already been removed by a call to deregister()
if (!messageNode) return;
var match = findPreviousMessage(parent, comment);
if (match) {
match.... | @ngdoc directive
@module ngMessages
@name ngMessages
@restrict AE
@description
`ngMessages` is a directive that is designed to show and hide messages based on the state
of a key/value object that it listens on. The directive itself complements error message
reporting with the `ngModel` $error object (which stores a ke... | removeMessageNode | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function isAttrTruthy(scope, attr) {
return (isString(attr) && attr.length === 0) || //empty attribute
truthy(scope.$eval(attr));
} | @ngdoc directive
@module ngMessages
@name ngMessages
@restrict AE
@description
`ngMessages` is a directive that is designed to show and hide messages based on the state
of a key/value object that it listens on. The directive itself complements error message
reporting with the `ngModel` $error object (which stores a ke... | isAttrTruthy | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function truthy(val) {
return isString(val) ? val.length : !!val;
} | @ngdoc directive
@module ngMessages
@name ngMessages
@restrict AE
@description
`ngMessages` is a directive that is designed to show and hide messages based on the state
of a key/value object that it listens on. The directive itself complements error message
reporting with the `ngModel` $error object (which stores a ke... | truthy | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function replaceElementWithMarker(element, src) {
// A comment marker is placed for debugging purposes
var comment = $compile.$$createComment ?
$compile.$$createComment('ngMessagesInclude', src) :
$document[0].createComment(' ngMessagesInclude: ' + src + ' ');
var marker = jqLite(c... | @ngdoc directive
@name ngMessagesInclude
@restrict AE
@scope
@description
`ngMessagesInclude` is a directive with the purpose to import existing ngMessage template
code from a remote template and place the downloaded template code into the exact spot
that the ngMessagesInclude directive is placed within the ngMessages... | replaceElementWithMarker | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function ngMessageDirectiveFactory(isDefault) {
return ['$animate', function($animate) {
return {
restrict: 'AE',
transclude: 'element',
priority: 1, // must run before ngBind, otherwise the text is set on the comment
terminal: true,
require: '^^ngMessages',
link: function(scop... | @ngdoc directive
@name ngMessageDefault
@restrict AE
@scope
@description
`ngMessageDefault` is a directive with the purpose to show and hide a default message for
{@link directive:ngMessages}, when none of provided messages matches.
More information about using `ngMessageDefault` can be found in the
{@link module:ngM... | ngMessageDirectiveFactory | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
assignRecords = function(items) {
records = items
? (isArray(items)
? items
: items.split(/[\s,]+/))
: null;
ngMessagesCtrl.reRender();
} | @ngdoc directive
@name ngMessageDefault
@restrict AE
@scope
@description
`ngMessageDefault` is a directive with the purpose to show and hide a default message for
{@link directive:ngMessages}, when none of provided messages matches.
More information about using `ngMessageDefault` can be found in the
{@link module:ngM... | assignRecords | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function contains(collection, key) {
if (collection) {
return isArray(collection)
? collection.indexOf(key) >= 0
: collection.hasOwnProperty(key);
}
} | @ngdoc directive
@name ngMessageDefault
@restrict AE
@scope
@description
`ngMessageDefault` is a directive with the purpose to show and hide a default message for
{@link directive:ngMessages}, when none of provided messages matches.
More information about using `ngMessageDefault` can be found in the
{@link module:ngM... | contains | javascript | angular/angular.js | src/ngMessages/messages.js | https://github.com/angular/angular.js/blob/master/src/ngMessages/messages.js | MIT |
function concat(array1, array2, index) {
return array1.concat(Array.prototype.slice.call(array2, index));
} | @ngdoc service
@name $log
@description
Mock implementation of {@link ng.$log} that gathers all logged messages in arrays
(one array per logging level). These arrays are exposed as `logs` property of each of the
level-specific log function, e.g. for level `error` the array is exposed as `$log.error.logs`. | concat | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
setIntervalFn = function(tick, delay, deferred, skipApply) {
var id = nextRepeatId++;
var fn = !skipApply ? tick : function() {
tick();
$browser.defer.flush();
};
repeatFns.push({
nextTime: (now + (delay || 0)),
delay: delay || 1,
... | @ngdoc service
@name $interval
@description
Mock implementation of the $interval service.
Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
move forward by `millis` milliseconds and trigger any functions scheduled to run in that
time.
@param {function()} fn A function that should be called repeatedly.
... | setIntervalFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
clearIntervalFn = function(id) {
for (var fnIndex = repeatFns.length - 1; fnIndex >= 0; fnIndex--) {
if (repeatFns[fnIndex].id === id) {
repeatFns.splice(fnIndex, 1);
break;
}
}
} | @ngdoc service
@name $interval
@description
Mock implementation of the $interval service.
Use {@link ngMock.$interval#flush `$interval.flush(millis)`} to
move forward by `millis` milliseconds and trigger any functions scheduled to run in that
time.
@param {function()} fn A function that should be called repeatedly.
... | clearIntervalFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function jsonStringToDate(string) {
// The R_ISO8061_STR regex is never going to fit into the 100 char limit!
// eslit-disable-next-line max-len
var R_ISO8061_STR = /^(-?\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d{3}))?)?)?(Z|([+-])(\d\d):?(\d\d)))?$/;
var match;
if ((match = string.match(... | @ngdoc method
@name $interval#flush
@description
Runs interval tasks scheduled to be run in the next `millis` milliseconds.
@param {number} millis maximum timeout amount to flush up until.
@return {number} The amount of time moved forward. | jsonStringToDate | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function toInt(str) {
return parseInt(str, 10);
} | @ngdoc method
@name $interval#flush
@description
Runs interval tasks scheduled to be run in the next `millis` milliseconds.
@param {number} millis maximum timeout amount to flush up until.
@return {number} The amount of time moved forward. | toInt | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function padNumberInMock(num, digits, trim) {
var neg = '';
if (num < 0) {
neg = '-';
num = -num;
}
num = '' + num;
while (num.length < digits) num = '0' + num;
if (trim) {
num = num.substr(num.length - digits);
}
return neg + num;
} | @ngdoc method
@name $interval#flush
@description
Runs interval tasks scheduled to be run in the next `millis` milliseconds.
@param {number} millis maximum timeout amount to flush up until.
@return {number} The amount of time moved forward. | padNumberInMock | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
queueFn = function() {
return function(fn) {
queue.push(fn);
};
} | @ngdoc service
@name $animate
@description
Mock implementation of the {@link ng.$animate `$animate`} service. Exposes two additional methods
for testing animations.
You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))` | queueFn | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
animateJsConstructor = function() {
var animator = $delegate.apply($delegate, arguments);
// If no javascript animation is found, animator is undefined
if (animator) {
runners.push(animator);
}
return animator;
} | @ngdoc service
@name $animate
@description
Mock implementation of the {@link ng.$animate `$animate`} service. Exposes two additional methods
for testing animations.
You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))` | animateJsConstructor | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
animateCssConstructor = function(element, options) {
var animator = $delegate(element, options);
runners.push(animator);
return animator;
} | @ngdoc service
@name $animate
@description
Mock implementation of the {@link ng.$animate `$animate`} service. Exposes two additional methods
for testing animations.
You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))` | animateCssConstructor | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
get reflows() {
return $$forceReflow.totalReflows;
} | @ngdoc service
@name $animate
@description
Mock implementation of the {@link ng.$animate `$animate`} service. Exposes two additional methods
for testing animations.
You need to require the `ngAnimateMock` module in your test suite for instance `beforeEach(module('ngAnimateMock'))` | reflows | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function serialize(object) {
var out;
if (angular.isElement(object)) {
object = angular.element(object);
out = angular.element('<div></div>');
angular.forEach(object, function(element) {
out.append(angular.element(element).clone());
});
out = out.html();
} else if (ang... | @ngdoc function
@name angular.mock.dump
@description
*NOTE*: This is not an injectable instance, just a globally available function.
Method for serializing common AngularJS objects (scope, elements, etc..) into strings.
It is useful for logging objects to the console when debugging.
@param {*} object - any object to... | serialize | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
function serializeScope(scope, offset) {
offset = offset || ' ';
var log = [offset + 'Scope(' + scope.$id + '): {'];
for (var key in scope) {
if (Object.prototype.hasOwnProperty.call(scope, key) && !key.match(/^(\$|this)/)) {
log.push(' ' + key + ': ' + angular.toJson(scope[key]));
}
... | @ngdoc function
@name angular.mock.dump
@description
*NOTE*: This is not an injectable instance, just a globally available function.
Method for serializing common AngularJS objects (scope, elements, etc..) into strings.
It is useful for logging objects to the console when debugging.
@param {*} object - any object to... | serializeScope | javascript | angular/angular.js | src/ngMock/angular-mocks.js | https://github.com/angular/angular.js/blob/master/src/ngMock/angular-mocks.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.