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 jqLiteAcceptsData(node) {
// The window object can accept data but has no nodeType
// Otherwise we are only interested in elements (1) and documents (9)
var nodeType = node.nodeType;
return nodeType === NODE_TYPE_ELEMENT || !nodeType || nodeType === NODE_TYPE_DOCUMENT;
} | Converts kebab-case to camelCase.
@param name Name to normalize | jqLiteAcceptsData | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function jqLiteHasData(node) {
for (var key in jqCache[node.ng339]) {
return true;
}
return false;
} | Converts kebab-case to camelCase.
@param name Name to normalize | jqLiteHasData | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function jqLiteBuildFragment(html, context) {
var tmp, tag, wrap, finalHtml,
fragment = context.createDocumentFragment(),
nodes = [], i;
if (jqLiteIsTextNode(html)) {
// Convert non-html into a text node
nodes.push(context.createTextNode(html));
} else {
// Convert html into DOM nodes
... | Converts kebab-case to camelCase.
@param name Name to normalize | jqLiteBuildFragment | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function jqLiteParseHTML(html, context) {
context = context || window.document;
var parsed;
if ((parsed = SINGLE_TAG_REGEXP.exec(html))) {
return [context.createElement(parsed[1])];
}
if ((parsed = jqLiteBuildFragment(html, context))) {
return parsed.childNodes;
}
return [];
} | Converts kebab-case to camelCase.
@param name Name to normalize | jqLiteParseHTML | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function jqLiteWrapNode(node, wrapper) {
var parent = node.parentNode;
if (parent) {
parent.replaceChild(wrapper, node);
}
wrapper.appendChild(node);
} | Converts kebab-case to camelCase.
@param name Name to normalize | jqLiteWrapNode | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function createEventHandler(element, events) {
var eventHandler = function(event, type) {
// jQuery specific api
event.isDefaultPrevented = function() {
return event.defaultPrevented;
};
var eventFns = events[type || event.type];
var eventFnsLength = eventFns ? eventFns.length : 0;
if ... | Properties: writes return selection, reads return first value | createEventHandler | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
eventHandler = function(event, type) {
// jQuery specific api
event.isDefaultPrevented = function() {
return event.defaultPrevented;
};
var eventFns = events[type || event.type];
var eventFnsLength = eventFns ? eventFns.length : 0;
if (!eventFnsLength) return;
if (isUndefined(event.... | Properties: writes return selection, reads return first value | eventHandler | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function defaultHandlerWrapper(element, event, handler) {
handler.call(element, event);
} | Properties: writes return selection, reads return first value | defaultHandlerWrapper | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function specialMouseHandlerWrapper(target, event, handler) {
// Refer to jQuery's implementation of mouseenter & mouseleave
// Read about mouseenter and mouseleave:
// http://www.quirksmode.org/js/events_mouse.html#link8
var related = event.relatedTarget;
// For mousenter/leave call the handler if related is... | Properties: writes return selection, reads return first value | specialMouseHandlerWrapper | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
addHandler = function(type, specialHandlerWrapper, noEventListener) {
var eventFns = events[type];
if (!eventFns) {
eventFns = events[type] = [];
eventFns.specialHandlerWrapper = specialHandlerWrapper;
if (type !== '$destroy' && !noEventListener) {
element.addEventListener... | Properties: writes return selection, reads return first value | addHandler | javascript | angular/angular.js | src/jqLite.js | https://github.com/angular/angular.js/blob/master/src/jqLite.js | MIT |
function setupModuleLoader(window) {
var $injectorMinErr = minErr('$injector');
var ngMinErr = minErr('ng');
function ensure(obj, name, factory) {
return obj[name] || (obj[name] = factory());
}
var angular = ensure(window, 'angular', Object);
// We need to expose `angular.$$minErr` to modules such a... | @ngdoc type
@name angular.Module
@module ng
@description
Interface for configuring AngularJS {@link angular.module modules}. | setupModuleLoader | javascript | angular/angular.js | src/loader.js | https://github.com/angular/angular.js/blob/master/src/loader.js | MIT |
function ensure(obj, name, factory) {
return obj[name] || (obj[name] = factory());
} | @ngdoc type
@name angular.Module
@module ng
@description
Interface for configuring AngularJS {@link angular.module modules}. | ensure | javascript | angular/angular.js | src/loader.js | https://github.com/angular/angular.js/blob/master/src/loader.js | MIT |
assertNotHasOwnProperty = function(name, context) {
if (name === 'hasOwnProperty') {
throw ngMinErr('badname', 'hasOwnProperty is not a valid {0} name', context);
}
} | @ngdoc function
@name angular.module
@module ng
@description
The `angular.module` is a global place for creating, registering and retrieving AngularJS
modules.
All modules (AngularJS core or 3rd party) that should be available to an application must be
registered using this mechanism.
Passing one argument retrieves a... | assertNotHasOwnProperty | javascript | angular/angular.js | src/loader.js | https://github.com/angular/angular.js/blob/master/src/loader.js | MIT |
function invokeLater(provider, method, insertMethod, queue) {
if (!queue) queue = invokeQueue;
return function() {
queue[insertMethod || 'push']([provider, method, arguments]);
return moduleInstance;
};
} | @param {string} provider
@param {string} method
@param {String=} insertMethod
@returns {angular.Module} | invokeLater | javascript | angular/angular.js | src/loader.js | https://github.com/angular/angular.js/blob/master/src/loader.js | MIT |
function invokeLaterAndSetModuleName(provider, method, queue) {
if (!queue) queue = invokeQueue;
return function(recipeName, factoryFunction) {
if (factoryFunction && isFunction(factoryFunction)) factoryFunction.$$moduleName = name;
queue.push([provider, method, arguments]);
... | @param {string} provider
@param {string} method
@returns {angular.Module} | invokeLaterAndSetModuleName | javascript | angular/angular.js | src/loader.js | https://github.com/angular/angular.js/blob/master/src/loader.js | MIT |
function isValidObjectMaxDepth(maxDepth) {
return isNumber(maxDepth) && maxDepth > 0;
} | @private
@param {Number} maxDepth
@return {boolean} | isValidObjectMaxDepth | javascript | angular/angular.js | src/minErr.js | https://github.com/angular/angular.js/blob/master/src/minErr.js | MIT |
function minErr(module, ErrorConstructor) {
ErrorConstructor = ErrorConstructor || Error;
var url = 'https://errors.angularjs.org/"NG_VERSION_FULL"/';
var regex = url.replace('.', '\\.') + '[\\s\\S]*';
var errRegExp = new RegExp(regex, 'g');
return function() {
var code = arguments[0],
template = ... | @description
This object provides a utility for producing rich Error messages within
AngularJS. It can be called as follows:
var exampleMinErr = minErr('example');
throw exampleMinErr('one', 'This {0} is {1}', foo, bar);
The above creates an instance of minErr in the example namespace. The
resulting error will have ... | minErr | javascript | angular/angular.js | src/minErr.js | https://github.com/angular/angular.js/blob/master/src/minErr.js | MIT |
function routeToRegExp(path, opts) {
var keys = [];
var pattern = path
.replace(/([().])/g, '\\$1')
.replace(/(\/)?:(\w+)(\*\?|[?*])?/g, function(_, slash, key, option) {
var optional = option === '?' || option === '*?';
var star = option === '*' || option === '*?';
keys.push({name: key, ... | @param {string} path - The path to parse. (It is assumed to have query and hash stripped off.)
@param {Object} opts - Options.
@return {Object} - An object containing an array of path parameter names (`keys`) and a regular
expression (`regexp`) that can be used to identify a matching URL and extract the path
pa... | routeToRegExp | javascript | angular/angular.js | src/routeToRegExp.js | https://github.com/angular/angular.js/blob/master/src/routeToRegExp.js | MIT |
function stringifyFn(fn) {
return Function.prototype.toString.call(fn);
} | @ngdoc module
@name auto
@installation
@description
Implicit module which gets automatically added to each {@link auto.$injector $injector}. | stringifyFn | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function extractArgs(fn) {
var fnText = stringifyFn(fn).replace(STRIP_COMMENTS, ''),
args = fnText.match(ARROW_ARG) || fnText.match(FN_ARGS);
return args;
} | @ngdoc module
@name auto
@installation
@description
Implicit module which gets automatically added to each {@link auto.$injector $injector}. | extractArgs | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function anonFn(fn) {
// For anonymous functions, showing at the very least the function signature can help in
// debugging.
var args = extractArgs(fn);
if (args) {
return 'function(' + (args[1] || '').replace(/[\s\r\n]+/, ' ') + ')';
}
return 'fn';
} | @ngdoc module
@name auto
@installation
@description
Implicit module which gets automatically added to each {@link auto.$injector $injector}. | anonFn | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function annotate(fn, strictDi, name) {
var $inject,
argDecl,
last;
if (typeof fn === 'function') {
if (!($inject = fn.$inject)) {
$inject = [];
if (fn.length) {
if (strictDi) {
if (!isString(name) || !name) {
name = fn.name || anonFn(fn);
}
... | @ngdoc module
@name auto
@installation
@description
Implicit module which gets automatically added to each {@link auto.$injector $injector}. | annotate | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function createInjector(modulesToLoad, strictDi) {
strictDi = (strictDi === true);
var INSTANTIATING = {},
providerSuffix = 'Provider',
path = [],
loadedModules = new NgMap(),
providerCache = {
$provide: {
provider: supportObject(provider),
factory: supportObj... | @ngdoc method
@name $provide#decorator
@description
Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
intercepts the creation of a service, allowing it to override or modify the behavior of the
service. The return value of the decorator function may be the original servi... | createInjector | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function supportObject(delegate) {
return function(key, value) {
if (isObject(key)) {
forEach(key, reverseParams(delegate));
} else {
return delegate(key, value);
}
};
} | @ngdoc method
@name $provide#decorator
@description
Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
intercepts the creation of a service, allowing it to override or modify the behavior of the
service. The return value of the decorator function may be the original servi... | supportObject | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function provider(name, provider_) {
assertNotHasOwnProperty(name, 'service');
if (isFunction(provider_) || isArray(provider_)) {
provider_ = providerInjector.instantiate(provider_);
}
if (!provider_.$get) {
throw $injectorMinErr('pget', 'Provider \'{0}\' must define $get factory method.', n... | @ngdoc method
@name $provide#decorator
@description
Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
intercepts the creation of a service, allowing it to override or modify the behavior of the
service. The return value of the decorator function may be the original servi... | provider | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function enforceReturnValue(name, factory) {
return /** @this */ function enforcedReturnValue() {
var result = instanceInjector.invoke(factory, this);
if (isUndefined(result)) {
throw $injectorMinErr('undef', 'Provider \'{0}\' must return a value from $get factory method.', name);
}
... | @ngdoc method
@name $provide#decorator
@description
Register a **decorator function** with the {@link auto.$injector $injector}. A decorator function
intercepts the creation of a service, allowing it to override or modify the behavior of the
service. The return value of the decorator function may be the original servi... | enforceReturnValue | javascript | angular/angular.js | src/auto/injector.js | https://github.com/angular/angular.js/blob/master/src/auto/injector.js | MIT |
function $AnchorScrollProvider() {
var autoScrollingEnabled = true;
/**
* @ngdoc method
* @name $anchorScrollProvider#disableAutoScrolling
*
* @description
* By default, {@link ng.$anchorScroll $anchorScroll()} will automatically detect changes to
* {@link ng.$location#hash $location.hash()} and... | @ngdoc provider
@name $anchorScrollProvider
@this
@description
Use `$anchorScrollProvider` to disable automatic scrolling whenever
{@link ng.$location#hash $location.hash()} changes. | $AnchorScrollProvider | javascript | angular/angular.js | src/ng/anchorScroll.js | https://github.com/angular/angular.js/blob/master/src/ng/anchorScroll.js | MIT |
function domInsert(element, parentElement, afterElement) {
// if for some reason the previous element was removed
// from the dom sometime before this code runs then let's
// just stick to using the parent element as the anchor
if (afterElement) {
var afterNode = extractElementNode(after... | @ngdoc method
@name $animateProvider#classNameFilter
@description
Sets and/or returns the CSS class regular expression that is checked when performing
an animation. Upon bootstrap the classNameFilter value is not set at all and will
therefore enable $animate to attempt to perform an animation on any element that is tr... | domInsert | javascript | angular/angular.js | src/ng/animate.js | https://github.com/angular/angular.js/blob/master/src/ng/animate.js | MIT |
$CoreAnimateCssProvider = function() {
this.$get = ['$$rAF', '$q', '$$AnimateRunner', function($$rAF, $q, $$AnimateRunner) {
return function(element, initialOptions) {
// all of the animation functions should create
// a copy of the options data, however, if a
// parent service has already crea... | @ngdoc service
@name $animateCss
@kind object
@this
@description
This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
then the `$animateCss` service will actually perform animations.
Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}. | $CoreAnimateCssProvider | javascript | angular/angular.js | src/ng/animateCss.js | https://github.com/angular/angular.js/blob/master/src/ng/animateCss.js | MIT |
function run() {
$$rAF(function() {
applyAnimationContents();
if (!closed) {
runner.complete();
}
closed = true;
});
return runner;
} | @ngdoc service
@name $animateCss
@kind object
@this
@description
This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
then the `$animateCss` service will actually perform animations.
Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}. | run | javascript | angular/angular.js | src/ng/animateCss.js | https://github.com/angular/angular.js/blob/master/src/ng/animateCss.js | MIT |
function applyAnimationContents() {
if (options.addClass) {
element.addClass(options.addClass);
options.addClass = null;
}
if (options.removeClass) {
element.removeClass(options.removeClass);
options.removeClass = null;
}
if (options.to) {
... | @ngdoc service
@name $animateCss
@kind object
@this
@description
This is the core version of `$animateCss`. By default, only when the `ngAnimate` is included,
then the `$animateCss` service will actually perform animations.
Click here {@link ngAnimate.$animateCss to read the documentation for $animateCss}. | applyAnimationContents | javascript | angular/angular.js | src/ng/animateCss.js | https://github.com/angular/angular.js/blob/master/src/ng/animateCss.js | MIT |
function Browser(window, document, $log, $sniffer, $$taskTrackerFactory) {
var self = this,
location = window.location,
history = window.history,
setTimeout = window.setTimeout,
clearTimeout = window.clearTimeout,
pendingDeferIds = {},
taskTracker = $$taskTrackerFactory($log);
s... | @param {object} window The global window object.
@param {object} document jQuery wrapped document.
@param {object} $log window.console or an object with the same interface.
@param {object} $sniffer $sniffer service | Browser | javascript | angular/angular.js | src/ng/browser.js | https://github.com/angular/angular.js/blob/master/src/ng/browser.js | MIT |
function cacheStateAndFireUrlChange() {
pendingLocation = null;
fireStateOrUrlChange();
} | @name $browser#state
@description
This method is a getter.
Return history.state or null if history.state is undefined.
@returns {object} state | cacheStateAndFireUrlChange | javascript | angular/angular.js | src/ng/browser.js | https://github.com/angular/angular.js/blob/master/src/ng/browser.js | MIT |
function cacheState() {
// This should be the only place in $browser where `history.state` is read.
cachedState = getCurrentState();
cachedState = isUndefined(cachedState) ? null : cachedState;
// Prevent callbacks fo fire twice if both hashchange & popstate were fired.
if (equals(cachedState, last... | @name $browser#state
@description
This method is a getter.
Return history.state or null if history.state is undefined.
@returns {object} state | cacheState | javascript | angular/angular.js | src/ng/browser.js | https://github.com/angular/angular.js/blob/master/src/ng/browser.js | MIT |
function fireStateOrUrlChange() {
var prevLastHistoryState = lastHistoryState;
cacheState();
if (lastBrowserUrl === self.url() && prevLastHistoryState === cachedState) {
return;
}
lastBrowserUrl = self.url();
lastHistoryState = cachedState;
forEach(urlChangeListeners, function(listen... | @name $browser#state
@description
This method is a getter.
Return history.state or null if history.state is undefined.
@returns {object} state | fireStateOrUrlChange | javascript | angular/angular.js | src/ng/browser.js | https://github.com/angular/angular.js/blob/master/src/ng/browser.js | MIT |
function refresh(entry) {
if (entry !== freshEnd) {
if (!staleEnd) {
staleEnd = entry;
} else if (staleEnd === entry) {
staleEnd = entry.n;
}
link(entry.n, entry.p);
link(entry, freshEnd);
freshEnd = entry;
freshEnd.n... | makes the `entry` the freshEnd of the LRU linked list | refresh | javascript | angular/angular.js | src/ng/cacheFactory.js | https://github.com/angular/angular.js/blob/master/src/ng/cacheFactory.js | MIT |
function link(nextEntry, prevEntry) {
if (nextEntry !== prevEntry) {
if (nextEntry) nextEntry.p = prevEntry; //p stands for previous, 'prev' didn't minify
if (prevEntry) prevEntry.n = nextEntry; //n stands for next, 'next' didn't minify
}
} | bidirectionally links two entries of the LRU linked list | link | javascript | angular/angular.js | src/ng/cacheFactory.js | https://github.com/angular/angular.js/blob/master/src/ng/cacheFactory.js | MIT |
function $TemplateCacheProvider() {
this.$get = ['$cacheFactory', function($cacheFactory) {
return $cacheFactory('templates');
}];
} | @ngdoc service
@name $templateCache
@this
@description
`$templateCache` is a {@link $cacheFactory.Cache Cache object} created by the
{@link ng.$cacheFactory $cacheFactory}.
The first time a template is used, it is loaded in the template cache for quick retrieval. You
can load templates directly into the cache in a `s... | $TemplateCacheProvider | javascript | angular/angular.js | src/ng/cacheFactory.js | https://github.com/angular/angular.js/blob/master/src/ng/cacheFactory.js | MIT |
function registerContext(ctx, values) {
forEach(values, function(v) { PROP_CONTEXTS[v.toLowerCase()] = ctx; });
} | @ngdoc method
@name $compileProvider#addPropertySecurityContext
@description
Defines the security context for DOM properties bound by ng-prop-*.
@param {string} elementName The element name or '*' to match any element.
@param {string} propertyName The DOM property name.
@param {string} ctx The {@link $sce} security c... | registerContext | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function flushOnChangesQueue() {
try {
if (!(--onChangesTtl)) {
// We have hit the TTL limit so reset everything
onChangesQueue = undefined;
throw $compileMinErr('infchng', '{0} $onChanges() iterations reached. Aborting!\n', TTL);
}
// We must run this hook in... | @ngdoc method
@name $compileProvider#addPropertySecurityContext
@description
Defines the security context for DOM properties bound by ng-prop-*.
@param {string} elementName The element name or '*' to match any element.
@param {string} propertyName The DOM property name.
@param {string} ctx The {@link $sce} security c... | flushOnChangesQueue | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function sanitizeSrcset(value, invokeType) {
if (!value) {
return value;
}
if (!isString(value)) {
throw $compileMinErr('srcset', 'Can\'t pass trusted values to `{0}`: "{1}"', invokeType, value.toString());
}
// Such values are a bit too complex to handle automatically ins... | @ngdoc method
@name $compileProvider#addPropertySecurityContext
@description
Defines the security context for DOM properties bound by ng-prop-*.
@param {string} elementName The element name or '*' to match any element.
@param {string} propertyName The DOM property name.
@param {string} ctx The {@link $sce} security c... | sanitizeSrcset | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function Attributes(element, attributesToCopy) {
if (attributesToCopy) {
var keys = Object.keys(attributesToCopy);
var i, l, key;
for (i = 0, l = keys.length; i < l; i++) {
key = keys[i];
this[key] = attributesToCopy[key];
}
} else {
this.$attr = ... | @ngdoc method
@name $compileProvider#addPropertySecurityContext
@description
Defines the security context for DOM properties bound by ng-prop-*.
@param {string} elementName The element name or '*' to match any element.
@param {string} propertyName The DOM property name.
@param {string} ctx The {@link $sce} security c... | Attributes | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function setSpecialAttr(element, attrName, value) {
// Attributes names that do not start with letters (such as `(click)`) cannot be set using `setAttribute`
// so we have to jump through some hoops to get such an attribute
// https://github.com/angular/angular.js/pull/13318
specialAttrHolder.in... | @ngdoc method
@name $compile.directive.Attributes#$observe
@kind function
@description
Observes an interpolated attribute.
The observer function will be invoked once during the next `$digest` following
compilation. The observer is then invoked whenever the interpolated value
changes.
@param {string} key Normalized k... | setSpecialAttr | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function safeAddClass($element, className) {
try {
$element.addClass(className);
} catch (e) {
// ignore, since it means that we are trying to set class on
// SVG element, where class name is read-only.
}
} | @ngdoc method
@name $compile.directive.Attributes#$observe
@kind function
@description
Observes an interpolated attribute.
The observer function will be invoked once during the next `$digest` following
compilation. The observer is then invoked whenever the interpolated value
changes.
@param {string} key Normalized k... | safeAddClass | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function compile($compileNodes, transcludeFn, maxPriority, ignoreDirective,
previousCompileContext) {
if (!($compileNodes instanceof jqLite)) {
// jquery always rewraps, whereas we need to preserve the original selector so that we can
// modify it.
$compileNodes = j... | @ngdoc method
@name $compile.directive.Attributes#$observe
@kind function
@description
Observes an interpolated attribute.
The observer function will be invoked once during the next `$digest` following
compilation. The observer is then invoked whenever the interpolated value
changes.
@param {string} key Normalized k... | compile | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function detectNamespaceForChildElements(parentElement) {
// TODO: Make this detect MathML as well...
var node = parentElement && parentElement[0];
if (!node) {
return 'html';
} else {
return nodeName_(node) !== 'foreignobject' && toString.call(node).match(/SVG/) ? 'svg' : 'html'... | @ngdoc method
@name $compile.directive.Attributes#$observe
@kind function
@description
Observes an interpolated attribute.
The observer function will be invoked once during the next `$digest` following
compilation. The observer is then invoked whenever the interpolated value
changes.
@param {string} key Normalized k... | detectNamespaceForChildElements | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function compileNodes(nodeList, transcludeFn, $rootElement, maxPriority, ignoreDirective,
previousCompileContext) {
var linkFns = [],
// `nodeList` can be either an element's `.childNodes` (live NodeList)
// or a jqLite/jQuery collection or an array
notLiv... | Compile function matches each node in nodeList against the directives. Once all directives
for a particular node are collected their compile functions are executed. The compile
functions return values - the linking functions - are combined into a composite linking
function, which is the a linking function for the node.... | compileNodes | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function compositeLinkFn(scope, nodeList, $rootElement, parentBoundTranscludeFn) {
var nodeLinkFn, childLinkFn, node, childScope, i, ii, idx, childBoundTranscludeFn;
var stableNodeList;
if (nodeLinkFnFound) {
// copy nodeList so that if a nodeLinkFn removes or adds an element at this... | Compile function matches each node in nodeList against the directives. Once all directives
for a particular node are collected their compile functions are executed. The compile
functions return values - the linking functions - are combined into a composite linking
function, which is the a linking function for the node.... | compositeLinkFn | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function mergeConsecutiveTextNodes(nodeList, idx, notLiveList) {
var node = nodeList[idx];
var parent = node.parentNode;
var sibling;
if (node.nodeType !== NODE_TYPE_TEXT) {
return;
}
while (true) {
sibling = parent ? node.nextSibling : nodeList[idx + 1];
if... | Compile function matches each node in nodeList against the directives. Once all directives
for a particular node are collected their compile functions are executed. The compile
functions return values - the linking functions - are combined into a composite linking
function, which is the a linking function for the node.... | mergeConsecutiveTextNodes | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function createBoundTranscludeFn(scope, transcludeFn, previousBoundTranscludeFn) {
function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
if (!transcludedScope) {
transcludedScope = scope.$new(false, containingScope);
transcludedScop... | Compile function matches each node in nodeList against the directives. Once all directives
for a particular node are collected their compile functions are executed. The compile
functions return values - the linking functions - are combined into a composite linking
function, which is the a linking function for the node.... | createBoundTranscludeFn | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function boundTranscludeFn(transcludedScope, cloneFn, controllers, futureParentElement, containingScope) {
if (!transcludedScope) {
transcludedScope = scope.$new(false, containingScope);
transcludedScope.$$transcluded = true;
}
return transcludeFn(transcludedScope, cloneFn,... | Compile function matches each node in nodeList against the directives. Once all directives
for a particular node are collected their compile functions are executed. The compile
functions return values - the linking functions - are combined into a composite linking
function, which is the a linking function for the node.... | boundTranscludeFn | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function collectDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
var nodeType = node.nodeType,
attrsMap = attrs.$attr,
match,
nodeName,
className;
switch (nodeType) {
case NODE_TYPE_ELEMENT: /* Element */
nodeName = nodeName_(nod... | Looks for directives on the given node and adds them to the directive collection which is
sorted.
@param node Node to search.
@param directives An array to which the directives are added to. This array is sorted before
the function returns.
@param attrs The shared attrs object which is used to populate the norm... | collectDirectives | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function collectCommentDirectives(node, directives, attrs, maxPriority, ignoreDirective) {
// function created because of performance, try/catch disables
// the optimization of the whole function #14848
try {
var match = COMMENT_DIRECTIVE_REGEXP.exec(node.nodeValue);
if (match) {
... | Looks for directives on the given node and adds them to the directive collection which is
sorted.
@param node Node to search.
@param directives An array to which the directives are added to. This array is sorted before
the function returns.
@param attrs The shared attrs object which is used to populate the norm... | collectCommentDirectives | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function groupScan(node, attrStart, attrEnd) {
var nodes = [];
var depth = 0;
if (attrStart && node.hasAttribute && node.hasAttribute(attrStart)) {
do {
if (!node) {
throw $compileMinErr('uterdir',
'Unterminated attribute, found \'{0}\' but no matchi... | Given a node with a directive-start it collects all of the siblings until it finds
directive-end.
@param node
@param attrStart
@param attrEnd
@returns {*} | groupScan | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function groupElementsLinkFnWrapper(linkFn, attrStart, attrEnd) {
return function groupedElementsLink(scope, element, attrs, controllers, transcludeFn) {
element = groupScan(element[0], attrStart, attrEnd);
return linkFn(scope, element, attrs, controllers, transcludeFn);
};
} | Wrapper for linking function which converts normal linking function into a grouped
linking function.
@param linkFn
@param attrStart
@param attrEnd
@returns {Function} | groupElementsLinkFnWrapper | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function compilationGenerator(eager, $compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext) {
var compiled;
if (eager) {
return compile($compileNodes, transcludeFn, maxPriority, ignoreDirective, previousCompileContext);
}
return /** @this */ function lazyComp... | A function generator that is used to support both eager and lazy compilation
linking function.
@param eager
@param $compileNodes
@param transcludeFn
@param maxPriority
@param ignoreDirective
@param previousCompileContext
@returns {Function} | compilationGenerator | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function applyDirectivesToNode(directives, compileNode, templateAttrs, transcludeFn,
jqCollection, originalReplaceDirective, preLinkFns, postLinkFns,
previousCompileContext) {
previousCompileContext = previousCompileContext || {};
var te... | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | applyDirectivesToNode | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function addLinkFns(pre, post, attrStart, attrEnd) {
if (pre) {
if (attrStart) pre = groupElementsLinkFnWrapper(pre, attrStart, attrEnd);
pre.require = directive.require;
pre.directiveName = directiveName;
if (newIsolateScopeDirective === directive || directive.$$isolateS... | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | addLinkFns | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function nodeLinkFn(childLinkFn, scope, linkNode, $rootElement, boundTranscludeFn) {
var i, ii, linkFn, isolateScope, controllerScope, elementControllers, transcludeFn, $element,
attrs, scopeBindingInfo;
if (compileNode === linkNode) {
attrs = templateAttrs;
$element = t... | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | nodeLinkFn | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function controllersBoundTransclude(scope, cloneAttachFn, futureParentElement, slotName) {
var transcludeControllers;
// No scope passed in:
if (!isScope(scope)) {
slotName = futureParentElement;
futureParentElement = cloneAttachFn;
cloneAttachFn = scope... | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | controllersBoundTransclude | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function getControllers(directiveName, require, $element, elementControllers) {
var value;
if (isString(require)) {
var match = require.match(REQUIRE_PREFIX_REGEXP);
var name = require.substring(match[0].length);
var inheritType = match[1] || match[3];
var optional = match[2... | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | getControllers | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function setupControllers($element, attrs, transcludeFn, controllerDirectives, isolateScope, scope, newIsolateScopeDirective) {
var elementControllers = createMap();
for (var controllerKey in controllerDirectives) {
var directive = controllerDirectives[controllerKey];
var locals = {
... | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | setupControllers | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function markDirectiveScope(directives, isolateScope, newScope) {
for (var j = 0, jj = directives.length; j < jj; j++) {
directives[j] = inherit(directives[j], {$$isolateScope: isolateScope, $$newScope: newScope});
}
} | Once the directives have been collected, their compile functions are executed. This method
is responsible for inlining directive templates as well as terminating the application
of the directives if the terminal directive has been reached.
@param {Array} directives Array of collected directives to execute their compil... | markDirectiveScope | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function addDirective(tDirectives, name, location, maxPriority, ignoreDirective, startAttrName,
endAttrName) {
if (name === ignoreDirective) return null;
var match = null;
if (hasDirectives.hasOwnProperty(name)) {
for (var directive, directives = $injector.get(name + ... | looks up the directive and decorates it with exception handling and proper parameters. We
call this the boundDirective.
@param {string} name name of the directive to look up.
@param {string} location The directive must be found in specific format.
String containing any of theses characters:
* `E`: element name
... | addDirective | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function directiveIsMultiElement(name) {
if (hasDirectives.hasOwnProperty(name)) {
for (var directive, directives = $injector.get(name + Suffix),
i = 0, ii = directives.length; i < ii; i++) {
directive = directives[i];
if (directive.multiElement) {
return true;
... | looks up the directive and returns true if it is a multi-element directive,
and therefore requires DOM nodes between -start and -end markers to be grouped
together.
@param {string} name name of the directive to look up.
@returns true if directive was registered as multi-element. | directiveIsMultiElement | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function mergeTemplateAttributes(dst, src) {
var srcAttr = src.$attr,
dstAttr = dst.$attr;
// reapply the old attributes to the new element
forEach(dst, function(value, key) {
if (key.charAt(0) !== '$') {
if (src[key] && src[key] !== value) {
if (value.length) ... | When the element is replaced with HTML template then the new attributes
on the template need to be merged with the existing attributes in the DOM.
The desired effect is to have both of the attributes present.
@param {object} dst destination attributes (original DOM)
@param {object} src source attributes (from the dire... | mergeTemplateAttributes | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function compileTemplateUrl(directives, $compileNode, tAttrs,
$rootElement, childTranscludeFn, preLinkFns, postLinkFns, previousCompileContext) {
var linkQueue = [],
afterTemplateNodeLinkFn,
afterTemplateChildLinkFn,
beforeTemplateCompileNode = $compileNode[0],
orig... | When the element is replaced with HTML template then the new attributes
on the template need to be merged with the existing attributes in the DOM.
The desired effect is to have both of the attributes present.
@param {object} dst destination attributes (original DOM)
@param {object} src source attributes (from the dire... | compileTemplateUrl | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function replaceWith($rootElement, elementsToRemove, newNode) {
var firstElementToRemove = elementsToRemove[0],
removeCount = elementsToRemove.length,
parent = firstElementToRemove.parentNode,
i, ii;
if ($rootElement) {
for (i = 0, ii = $rootElement.length; i < ii; i++... | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | replaceWith | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function cloneAndAnnotateFn(fn, annotation) {
return extend(function() { return fn.apply(null, arguments); }, fn, annotation);
} | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | cloneAndAnnotateFn | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function invokeLinkFn(linkFn, scope, $element, attrs, controllers, transcludeFn) {
try {
linkFn(scope, $element, attrs, controllers, transcludeFn);
} catch (e) {
$exceptionHandler(e, startingTag($element));
}
} | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | invokeLinkFn | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function strictBindingsCheck(attrName, directiveName) {
if (strictComponentBindingsEnabled) {
throw $compileMinErr('missingattr',
'Attribute \'{0}\' of \'{1}\' is non-optional and must be set!',
attrName, directiveName);
}
} | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | strictBindingsCheck | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function initializeDirectiveBindings(scope, attrs, destination, bindings, directive) {
var removeWatchCollection = [];
var initialChanges = {};
var changes;
forEach(bindings, function initializeBinding(definition, scopeName) {
var attrName = definition.attrName,
optional = defin... | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | initializeDirectiveBindings | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
parentValueWatch = function parentValueWatch(parentValue) {
if (!compare(parentValue, destination[scopeName])) {
// we are out of sync and need to copy
if (!compare(parentValue, lastValue)) {
// parent changed and it has precedence
destin... | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | parentValueWatch | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function recordChanges(key, currentValue, previousValue) {
if (isFunction(destination.$onChanges) && !simpleCompare(currentValue, previousValue)) {
// If we have not already scheduled the top level onChangesQueue handler then do so now
if (!onChangesQueue) {
scope.$$postDigest(fl... | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | recordChanges | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function triggerOnChangesHook() {
destination.$onChanges(changes);
// Now clear the changes so that we schedule onChanges when more changes arrive
changes = undefined;
} | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | triggerOnChangesHook | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function SimpleChange(previous, current) {
this.previousValue = previous;
this.currentValue = current;
} | This is a special jqLite.replaceWith, which can replace items which
have no parents, provided that the containing jqLite collection is provided.
@param {JqLite=} $rootElement The root of the compile tree. Used so that we can replace nodes
in the root of the tree.
@param {JqLite} elementsT... | SimpleChange | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function directiveNormalize(name) {
return name
.replace(PREFIX_REGEXP, '')
.replace(SPECIAL_CHARS_REGEXP, function(_, letter, offset) {
return offset ? letter.toUpperCase() : letter;
});
} | Converts all accepted directives format into proper directive name.
@param name Name to normalize | directiveNormalize | javascript | angular/angular.js | src/ng/compile.js | https://github.com/angular/angular.js/blob/master/src/ng/compile.js | MIT |
function $ControllerProvider() {
var controllers = {};
/**
* @ngdoc method
* @name $controllerProvider#has
* @param {string} name Controller name to check.
*/
this.has = function(name) {
return controllers.hasOwnProperty(name);
};
/**
* @ngdoc method
* @name $controllerProvider#registe... | @ngdoc provider
@name $controllerProvider
@this
@description
The {@link ng.$controller $controller service} is used by AngularJS to create new
controllers.
This provider allows controller registration via the
{@link ng.$controllerProvider#register register} method. | $ControllerProvider | javascript | angular/angular.js | src/ng/controller.js | https://github.com/angular/angular.js/blob/master/src/ng/controller.js | MIT |
function addIdentifier(locals, identifier, instance, name) {
if (!(locals && isObject(locals.$scope))) {
throw minErr('$controller')('noscp',
'Cannot export controller \'{0}\' as \'{1}\'! No $scope object provided via `locals`.',
name, identifier);
}
locals.$scope[identifi... | @ngdoc service
@name $controller
@requires $injector
@param {Function|string} constructor If called with a function then it's considered to be the
controller constructor function. Otherwise it's considered to be a string which is used
to retrieve the controller constructor using the following steps:
* check ... | addIdentifier | javascript | angular/angular.js | src/ng/controller.js | https://github.com/angular/angular.js/blob/master/src/ng/controller.js | MIT |
function $$CookieReader($document) {
var rawDocument = $document[0] || {};
var lastCookies = {};
var lastCookieString = '';
function safeGetCookie(rawDocument) {
try {
return rawDocument.cookie || '';
} catch (e) {
return '';
}
}
function safeDecodeURIComponent(str) {
try {
... | @name $$cookieReader
@requires $document
@description
This is a private service for reading cookies used by $http and ngCookies
@return {Object} a key/value map of the current cookies | $$CookieReader | javascript | angular/angular.js | src/ng/cookieReader.js | https://github.com/angular/angular.js/blob/master/src/ng/cookieReader.js | MIT |
function safeGetCookie(rawDocument) {
try {
return rawDocument.cookie || '';
} catch (e) {
return '';
}
} | @name $$cookieReader
@requires $document
@description
This is a private service for reading cookies used by $http and ngCookies
@return {Object} a key/value map of the current cookies | safeGetCookie | javascript | angular/angular.js | src/ng/cookieReader.js | https://github.com/angular/angular.js/blob/master/src/ng/cookieReader.js | MIT |
function safeDecodeURIComponent(str) {
try {
return decodeURIComponent(str);
} catch (e) {
return str;
}
} | @name $$cookieReader
@requires $document
@description
This is a private service for reading cookies used by $http and ngCookies
@return {Object} a key/value map of the current cookies | safeDecodeURIComponent | javascript | angular/angular.js | src/ng/cookieReader.js | https://github.com/angular/angular.js/blob/master/src/ng/cookieReader.js | MIT |
function $DocumentProvider() {
this.$get = ['$window', function(window) {
return jqLite(window.document);
}];
} | @ngdoc service
@name $document
@requires $window
@this
@description
A {@link angular.element jQuery or jqLite} wrapper for the browser's `window.document` object.
@example
<example module="documentExample" name="document">
<file name="index.html">
<div ng-controller="ExampleController">
<p>$do... | $DocumentProvider | javascript | angular/angular.js | src/ng/document.js | https://github.com/angular/angular.js/blob/master/src/ng/document.js | MIT |
function $$IsDocumentHiddenProvider() {
this.$get = ['$document', '$rootScope', function($document, $rootScope) {
var doc = $document[0];
var hidden = doc && doc.hidden;
$document.on('visibilitychange', changeListener);
$rootScope.$on('$destroy', function() {
$document.off('visibilitychange', ... | @private
@this
Listens for document visibility change and makes the current status accessible. | $$IsDocumentHiddenProvider | javascript | angular/angular.js | src/ng/document.js | https://github.com/angular/angular.js/blob/master/src/ng/document.js | MIT |
function changeListener() {
hidden = doc.hidden;
} | @private
@this
Listens for document visibility change and makes the current status accessible. | changeListener | javascript | angular/angular.js | src/ng/document.js | https://github.com/angular/angular.js/blob/master/src/ng/document.js | MIT |
function $ExceptionHandlerProvider() {
this.$get = ['$log', function($log) {
return function(exception, cause) {
$log.error.apply($log, arguments);
};
}];
} | @ngdoc service
@name $exceptionHandler
@requires ng.$log
@this
@description
Any uncaught exception in AngularJS expressions is delegated to this service.
The default implementation simply delegates to `$log.error` which logs it into
the browser console.
In unit tests, if `angular-mocks.js` is loaded, this service is ... | $ExceptionHandlerProvider | javascript | angular/angular.js | src/ng/exceptionHandler.js | https://github.com/angular/angular.js/blob/master/src/ng/exceptionHandler.js | MIT |
function register(name, factory) {
if (isObject(name)) {
var filters = {};
forEach(name, function(filter, key) {
filters[key] = register(key, filter);
});
return filters;
} else {
return $provide.factory(name + suffix, factory);
}
} | @ngdoc method
@name $filterProvider#register
@param {string|Object} name Name of the filter function, or an object map of filters where
the keys are the filter names and the values are the filter factories.
<div class="alert alert-warning">
**Note:** Filter names must be valid AngularJS {@link expression} ide... | register | javascript | angular/angular.js | src/ng/filter.js | https://github.com/angular/angular.js/blob/master/src/ng/filter.js | MIT |
function serialize(toSerialize, prefix, topLevel) {
if (isArray(toSerialize)) {
forEach(toSerialize, function(value, index) {
serialize(value, prefix + '[' + (isObject(value) ? index : '') + ']');
});
} else if (isObject(toSerialize) && !isDate(toSerialize)) {
f... | @ngdoc service
@name $httpParamSerializerJQLike
@description
Alternative {@link $http `$http`} params serializer that follows
jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
The serializer will also sort the params alphabetically.
To use it for serializing `$http` request parameters, set it a... | serialize | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function defaultHttpResponseTransform(data, headers) {
if (isString(data)) {
// Strip json vulnerability protection prefix and trim whitespace
var tempData = data.replace(JSON_PROTECTION_PREFIX, '').trim();
if (tempData) {
var contentType = headers('Content-Type');
var hasJsonContentType = co... | @ngdoc service
@name $httpParamSerializerJQLike
@description
Alternative {@link $http `$http`} params serializer that follows
jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
The serializer will also sort the params alphabetically.
To use it for serializing `$http` request parameters, set it a... | defaultHttpResponseTransform | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function isJsonLike(str) {
var jsonStart = str.match(JSON_START);
return jsonStart && JSON_ENDS[jsonStart[0]].test(str);
} | @ngdoc service
@name $httpParamSerializerJQLike
@description
Alternative {@link $http `$http`} params serializer that follows
jQuery's [`param()`](http://api.jquery.com/jquery.param/) method logic.
The serializer will also sort the params alphabetically.
To use it for serializing `$http` request parameters, set it a... | isJsonLike | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function parseHeaders(headers) {
var parsed = createMap(), i;
function fillInParsed(key, val) {
if (key) {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
}
if (isString(headers)) {
forEach(headers.split('\n'), function(line) {
i = line.indexOf(':');
fillInParsed(lo... | Parse headers into key value object
@param {string} headers Raw headers as a string
@returns {Object} Parsed headers as key value object | parseHeaders | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function fillInParsed(key, val) {
if (key) {
parsed[key] = parsed[key] ? parsed[key] + ', ' + val : val;
}
} | Parse headers into key value object
@param {string} headers Raw headers as a string
@returns {Object} Parsed headers as key value object | fillInParsed | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function headersGetter(headers) {
var headersObj;
return function(name) {
if (!headersObj) headersObj = parseHeaders(headers);
if (name) {
var value = headersObj[lowercase(name)];
if (value === undefined) {
value = null;
}
return value;
}
return headersObj;
};
} | Returns a function that provides access to parsed headers.
Headers are lazy parsed when first requested.
@see parseHeaders
@param {(string|Object)} headers Headers to provide access to.
@returns {function(string=)} Returns a getter function which if called with:
- if called with an argument returns a single header... | headersGetter | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function transformData(data, headers, status, fns) {
if (isFunction(fns)) {
return fns(data, headers, status);
}
forEach(fns, function(fn) {
data = fn(data, headers, status);
});
return data;
} | Chain all given functions
This function is used for both request and response transforming
@param {*} data Data to transform.
@param {function(string=)} headers HTTP headers getter fn.
@param {number} status HTTP status code of the response.
@param {(Function|Array.<Function>)} fns Function or an array of functions.
... | transformData | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function isSuccess(status) {
return 200 <= status && status < 300;
} | Chain all given functions
This function is used for both request and response transforming
@param {*} data Data to transform.
@param {function(string=)} headers HTTP headers getter fn.
@param {number} status HTTP status code of the response.
@param {(Function|Array.<Function>)} fns Function or an array of functions.
... | isSuccess | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function createShortMethods(names) {
forEach(arguments, function(name) {
$http[name] = function(url, config) {
return $http(extend({}, config || {}, {
method: name,
url: url
}));
};
});
} | @ngdoc property
@name $http#defaults
@description
Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
default headers, withCredentials as well as request and response transformations.
See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. | createShortMethods | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function createShortMethodsWithData(name) {
forEach(arguments, function(name) {
$http[name] = function(url, data, config) {
return $http(extend({}, config || {}, {
method: name,
url: url,
data: data
}));
};
});
} | @ngdoc property
@name $http#defaults
@description
Runtime equivalent of the `$httpProvider.defaults` property. Allows configuration of
default headers, withCredentials as well as request and response transformations.
See "Setting HTTP Headers" and "Transforming Requests and Responses" sections above. | createShortMethodsWithData | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function sendReq(config, reqData) {
var deferred = $q.defer(),
promise = deferred.promise,
cache,
cachedResp,
reqHeaders = config.headers,
isJsonp = lowercase(config.method) === 'jsonp',
url = config.url;
if (isJsonp) {
// JSONP is a prett... | Makes the request.
!!! ACCESSES CLOSURE VARS:
$httpBackend, defaults, $log, $rootScope, defaultCache, $http.pendingRequests | sendReq | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function done(status, response, headersString, statusText, xhrStatus) {
if (cache) {
if (isSuccess(status)) {
cache.put(url, [status, response, parseHeaders(headersString), statusText, xhrStatus]);
} else {
// remove promise from the cache
cache.remove(url... | Callback registered to $httpBackend():
- caches the response if desired
- resolves the raw $http promise
- calls $apply | done | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
function resolveHttpPromise() {
resolvePromise(response, status, headersString, statusText, xhrStatus);
} | Callback registered to $httpBackend():
- caches the response if desired
- resolves the raw $http promise
- calls $apply | resolveHttpPromise | javascript | angular/angular.js | src/ng/http.js | https://github.com/angular/angular.js/blob/master/src/ng/http.js | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.