repo
stringlengths
5
67
path
stringlengths
4
116
func_name
stringlengths
0
58
original_string
stringlengths
52
373k
language
stringclasses
1 value
code
stringlengths
52
373k
code_tokens
list
docstring
stringlengths
4
11.8k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
86
226
partition
stringclasses
1 value
angular/material
src/components/tabs/js/tabsController.js
removeTab
function removeTab (tabData) { if (destroyed) return; var selectedIndex = ctrl.selectedIndex, tab = ctrl.tabs.splice(tabData.getIndex(), 1)[ 0 ]; refreshIndex(); // when removing a tab, if the selected index did not change, we have to manually trigger the // tab select/deselect e...
javascript
function removeTab (tabData) { if (destroyed) return; var selectedIndex = ctrl.selectedIndex, tab = ctrl.tabs.splice(tabData.getIndex(), 1)[ 0 ]; refreshIndex(); // when removing a tab, if the selected index did not change, we have to manually trigger the // tab select/deselect e...
[ "function", "removeTab", "(", "tabData", ")", "{", "if", "(", "destroyed", ")", "return", ";", "var", "selectedIndex", "=", "ctrl", ".", "selectedIndex", ",", "tab", "=", "ctrl", ".", "tabs", ".", "splice", "(", "tabData", ".", "getIndex", "(", ")", ",...
Remove a tab from the data and select the nearest valid tab. @param {Object} tabData tab to remove
[ "Remove", "a", "tab", "from", "the", "data", "and", "select", "the", "nearest", "valid", "tab", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L421-L436
train
angular/material
src/components/tabs/js/tabsController.js
insertTab
function insertTab (tabData, index) { var hasLoaded = loaded; var proto = { getIndex: function () { return ctrl.tabs.indexOf(tab); }, isActive: function () { return this.getIndex() === ctrl.selectedIndex; }, isLeft: function () { return this.getIndex() < ctrl.selected...
javascript
function insertTab (tabData, index) { var hasLoaded = loaded; var proto = { getIndex: function () { return ctrl.tabs.indexOf(tab); }, isActive: function () { return this.getIndex() === ctrl.selectedIndex; }, isLeft: function () { return this.getIndex() < ctrl.selected...
[ "function", "insertTab", "(", "tabData", ",", "index", ")", "{", "var", "hasLoaded", "=", "loaded", ";", "var", "proto", "=", "{", "getIndex", ":", "function", "(", ")", "{", "return", "ctrl", ".", "tabs", ".", "indexOf", "(", "tab", ")", ";", "}", ...
Create an entry in the tabs array for a new tab at the specified index. @param {Object} tabData tab to insert @param {number} index location to insert the new tab @returns {Object} the inserted tab
[ "Create", "an", "entry", "in", "the", "tabs", "array", "for", "a", "new", "tab", "at", "the", "specified", "index", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L444-L481
train
angular/material
src/components/tabs/js/tabsController.js
getElements
function getElements () { var elements = {}; var node = $element[0]; // gather tab bar elements elements.wrapper = node.querySelector('md-tabs-wrapper'); elements.canvas = elements.wrapper.querySelector('md-tabs-canvas'); elements.paging = elements.canvas.querySelector('md-pagination-wrapper'...
javascript
function getElements () { var elements = {}; var node = $element[0]; // gather tab bar elements elements.wrapper = node.querySelector('md-tabs-wrapper'); elements.canvas = elements.wrapper.querySelector('md-tabs-canvas'); elements.paging = elements.canvas.querySelector('md-pagination-wrapper'...
[ "function", "getElements", "(", ")", "{", "var", "elements", "=", "{", "}", ";", "var", "node", "=", "$element", "[", "0", "]", ";", "// gather tab bar elements", "elements", ".", "wrapper", "=", "node", ".", "querySelector", "(", "'md-tabs-wrapper'", ")", ...
Getter methods Gathers references to all of the DOM elements used by this controller. @returns {Object}
[ "Getter", "methods", "Gathers", "references", "to", "all", "of", "the", "DOM", "elements", "used", "by", "this", "controller", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L489-L506
train
angular/material
src/components/tabs/js/tabsController.js
canPageForward
function canPageForward () { var elements = getElements(); var lastTab = elements.tabs[ elements.tabs.length - 1 ]; if (isRtl()) { return ctrl.offsetLeft < elements.paging.offsetWidth - elements.canvas.offsetWidth; } return lastTab && lastTab.offsetLeft + lastTab.offsetWidth > elements.canva...
javascript
function canPageForward () { var elements = getElements(); var lastTab = elements.tabs[ elements.tabs.length - 1 ]; if (isRtl()) { return ctrl.offsetLeft < elements.paging.offsetWidth - elements.canvas.offsetWidth; } return lastTab && lastTab.offsetLeft + lastTab.offsetWidth > elements.canva...
[ "function", "canPageForward", "(", ")", "{", "var", "elements", "=", "getElements", "(", ")", ";", "var", "lastTab", "=", "elements", ".", "tabs", "[", "elements", ".", "tabs", ".", "length", "-", "1", "]", ";", "if", "(", "isRtl", "(", ")", ")", "...
Determines whether or not the right pagination arrow should be enabled. @returns {*|boolean}
[ "Determines", "whether", "or", "not", "the", "right", "pagination", "arrow", "should", "be", "enabled", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L521-L531
train
angular/material
src/components/tabs/js/tabsController.js
getFocusedTabId
function getFocusedTabId() { var focusedTab = ctrl.tabs[ctrl.focusIndex]; if (!focusedTab || !focusedTab.id) { return null; } return 'tab-item-' + focusedTab.id; }
javascript
function getFocusedTabId() { var focusedTab = ctrl.tabs[ctrl.focusIndex]; if (!focusedTab || !focusedTab.id) { return null; } return 'tab-item-' + focusedTab.id; }
[ "function", "getFocusedTabId", "(", ")", "{", "var", "focusedTab", "=", "ctrl", ".", "tabs", "[", "ctrl", ".", "focusIndex", "]", ";", "if", "(", "!", "focusedTab", "||", "!", "focusedTab", ".", "id", ")", "{", "return", "null", ";", "}", "return", "...
Returns currently focused tab item's element ID
[ "Returns", "currently", "focused", "tab", "item", "s", "element", "ID" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L536-L542
train
angular/material
src/components/tabs/js/tabsController.js
shouldPaginate
function shouldPaginate () { var shouldPaginate; if (ctrl.noPagination || !loaded) return false; var canvasWidth = $element.prop('clientWidth'); angular.forEach(getElements().tabs, function (tab) { canvasWidth -= tab.offsetWidth; }); shouldPaginate = canvasWidth < 0; // Work around w...
javascript
function shouldPaginate () { var shouldPaginate; if (ctrl.noPagination || !loaded) return false; var canvasWidth = $element.prop('clientWidth'); angular.forEach(getElements().tabs, function (tab) { canvasWidth -= tab.offsetWidth; }); shouldPaginate = canvasWidth < 0; // Work around w...
[ "function", "shouldPaginate", "(", ")", "{", "var", "shouldPaginate", ";", "if", "(", "ctrl", ".", "noPagination", "||", "!", "loaded", ")", "return", "false", ";", "var", "canvasWidth", "=", "$element", ".", "prop", "(", "'clientWidth'", ")", ";", "angula...
Determines if pagination is necessary to display the tabs within the available space. @returns {boolean} true if pagination is necessary, false otherwise
[ "Determines", "if", "pagination", "is", "necessary", "to", "display", "the", "tabs", "within", "the", "available", "space", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L572-L592
train
angular/material
src/components/tabs/js/tabsController.js
getNearestSafeIndex
function getNearestSafeIndex (newIndex) { if (newIndex === -1) return -1; var maxOffset = Math.max(ctrl.tabs.length - newIndex, newIndex), i, tab; for (i = 0; i <= maxOffset; i++) { tab = ctrl.tabs[ newIndex + i ]; if (tab && (tab.scope.disabled !== true)) return tab.getIndex(); ta...
javascript
function getNearestSafeIndex (newIndex) { if (newIndex === -1) return -1; var maxOffset = Math.max(ctrl.tabs.length - newIndex, newIndex), i, tab; for (i = 0; i <= maxOffset; i++) { tab = ctrl.tabs[ newIndex + i ]; if (tab && (tab.scope.disabled !== true)) return tab.getIndex(); ta...
[ "function", "getNearestSafeIndex", "(", "newIndex", ")", "{", "if", "(", "newIndex", "===", "-", "1", ")", "return", "-", "1", ";", "var", "maxOffset", "=", "Math", ".", "max", "(", "ctrl", ".", "tabs", ".", "length", "-", "newIndex", ",", "newIndex", ...
Finds the nearest tab index that is available. This is primarily used for when the active tab is removed. @param newIndex @returns {*}
[ "Finds", "the", "nearest", "tab", "index", "that", "is", "available", ".", "This", "is", "primarily", "used", "for", "when", "the", "active", "tab", "is", "removed", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L600-L611
train
angular/material
src/components/tabs/js/tabsController.js
updateTabOrder
function updateTabOrder () { var selectedItem = ctrl.tabs[ ctrl.selectedIndex ], focusItem = ctrl.tabs[ ctrl.focusIndex ]; ctrl.tabs = ctrl.tabs.sort(function (a, b) { return a.index - b.index; }); ctrl.selectedIndex = ctrl.tabs.indexOf(selectedItem); ctrl.focusIndex ...
javascript
function updateTabOrder () { var selectedItem = ctrl.tabs[ ctrl.selectedIndex ], focusItem = ctrl.tabs[ ctrl.focusIndex ]; ctrl.tabs = ctrl.tabs.sort(function (a, b) { return a.index - b.index; }); ctrl.selectedIndex = ctrl.tabs.indexOf(selectedItem); ctrl.focusIndex ...
[ "function", "updateTabOrder", "(", ")", "{", "var", "selectedItem", "=", "ctrl", ".", "tabs", "[", "ctrl", ".", "selectedIndex", "]", ",", "focusItem", "=", "ctrl", ".", "tabs", "[", "ctrl", ".", "focusIndex", "]", ";", "ctrl", ".", "tabs", "=", "ctrl"...
Re-orders the tabs and updates the selected and focus indexes to their new positions. This is triggered by `tabDirective.js` when the user's tabs have been re-ordered.
[ "Re", "-", "orders", "the", "tabs", "and", "updates", "the", "selected", "and", "focus", "indexes", "to", "their", "new", "positions", ".", "This", "is", "triggered", "by", "tabDirective", ".", "js", "when", "the", "user", "s", "tabs", "have", "been", "r...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L679-L687
train
angular/material
src/components/tabs/js/tabsController.js
incrementIndex
function incrementIndex (inc, focus) { var newIndex, key = focus ? 'focusIndex' : 'selectedIndex', index = ctrl[ key ]; for (newIndex = index + inc; ctrl.tabs[ newIndex ] && ctrl.tabs[ newIndex ].scope.disabled; newIndex += inc) { /* do nothing */ } newIndex = (index + i...
javascript
function incrementIndex (inc, focus) { var newIndex, key = focus ? 'focusIndex' : 'selectedIndex', index = ctrl[ key ]; for (newIndex = index + inc; ctrl.tabs[ newIndex ] && ctrl.tabs[ newIndex ].scope.disabled; newIndex += inc) { /* do nothing */ } newIndex = (index + i...
[ "function", "incrementIndex", "(", "inc", ",", "focus", ")", "{", "var", "newIndex", ",", "key", "=", "focus", "?", "'focusIndex'", ":", "'selectedIndex'", ",", "index", "=", "ctrl", "[", "key", "]", ";", "for", "(", "newIndex", "=", "index", "+", "inc...
This moves the selected or focus index left or right. This is used by the keydown handler. @param {number} inc amount to increment @param {boolean} focus true to increment the focus index, false to increment the selected index
[ "This", "moves", "the", "selected", "or", "focus", "index", "left", "or", "right", ".", "This", "is", "used", "by", "the", "keydown", "handler", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L694-L707
train
angular/material
src/components/tabs/js/tabsController.js
redirectFocus
function redirectFocus () { ctrl.styleTabItemFocus = ($mdInteraction.getLastInteractionType() === 'keyboard'); var tabToFocus = getElements().tabs[ctrl.focusIndex]; if (tabToFocus) { tabToFocus.focus(); } }
javascript
function redirectFocus () { ctrl.styleTabItemFocus = ($mdInteraction.getLastInteractionType() === 'keyboard'); var tabToFocus = getElements().tabs[ctrl.focusIndex]; if (tabToFocus) { tabToFocus.focus(); } }
[ "function", "redirectFocus", "(", ")", "{", "ctrl", ".", "styleTabItemFocus", "=", "(", "$mdInteraction", ".", "getLastInteractionType", "(", ")", "===", "'keyboard'", ")", ";", "var", "tabToFocus", "=", "getElements", "(", ")", ".", "tabs", "[", "ctrl", "."...
This is used to forward focus to tab container elements. This method is necessary to avoid animation issues when attempting to focus an item that is out of view.
[ "This", "is", "used", "to", "forward", "focus", "to", "tab", "container", "elements", ".", "This", "method", "is", "necessary", "to", "avoid", "animation", "issues", "when", "attempting", "to", "focus", "an", "item", "that", "is", "out", "of", "view", "." ...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L713-L719
train
angular/material
src/components/tabs/js/tabsController.js
updateHasContent
function updateHasContent () { var hasContent = false; var i; for (i = 0; i < ctrl.tabs.length; i++) { if (ctrl.tabs[i].hasContent) { hasContent = true; break; } } ctrl.hasContent = hasContent; }
javascript
function updateHasContent () { var hasContent = false; var i; for (i = 0; i < ctrl.tabs.length; i++) { if (ctrl.tabs[i].hasContent) { hasContent = true; break; } } ctrl.hasContent = hasContent; }
[ "function", "updateHasContent", "(", ")", "{", "var", "hasContent", "=", "false", ";", "var", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "ctrl", ".", "tabs", ".", "length", ";", "i", "++", ")", "{", "if", "(", "ctrl", ".", "tabs", "[",...
Determines if the tab content area is needed.
[ "Determines", "if", "the", "tab", "content", "area", "is", "needed", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L766-L778
train
angular/material
src/components/tabs/js/tabsController.js
refreshIndex
function refreshIndex () { ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex); ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex); }
javascript
function refreshIndex () { ctrl.selectedIndex = getNearestSafeIndex(ctrl.selectedIndex); ctrl.focusIndex = getNearestSafeIndex(ctrl.focusIndex); }
[ "function", "refreshIndex", "(", ")", "{", "ctrl", ".", "selectedIndex", "=", "getNearestSafeIndex", "(", "ctrl", ".", "selectedIndex", ")", ";", "ctrl", ".", "focusIndex", "=", "getNearestSafeIndex", "(", "ctrl", ".", "focusIndex", ")", ";", "}" ]
Moves the indexes to their nearest valid values.
[ "Moves", "the", "indexes", "to", "their", "nearest", "valid", "values", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L783-L786
train
angular/material
src/components/tabs/js/tabsController.js
updateHeightFromContent
function updateHeightFromContent () { if (!ctrl.dynamicHeight) return $element.css('height', ''); if (!ctrl.tabs.length) return queue.push(updateHeightFromContent); var elements = getElements(); var tabContent = elements.contents[ ctrl.selectedIndex ], contentHeight = tabContent ? tabConten...
javascript
function updateHeightFromContent () { if (!ctrl.dynamicHeight) return $element.css('height', ''); if (!ctrl.tabs.length) return queue.push(updateHeightFromContent); var elements = getElements(); var tabContent = elements.contents[ ctrl.selectedIndex ], contentHeight = tabContent ? tabConten...
[ "function", "updateHeightFromContent", "(", ")", "{", "if", "(", "!", "ctrl", ".", "dynamicHeight", ")", "return", "$element", ".", "css", "(", "'height'", ",", "''", ")", ";", "if", "(", "!", "ctrl", ".", "tabs", ".", "length", ")", "return", "queue",...
Calculates the content height of the current tab. @returns {*}
[ "Calculates", "the", "content", "height", "of", "the", "current", "tab", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L792-L851
train
angular/material
src/components/tabs/js/tabsController.js
updateInkBarStyles
function updateInkBarStyles (previousTotalWidth, previousWidthOfTabItems) { if (ctrl.noInkBar) { return; } var elements = getElements(); if (!elements.tabs[ ctrl.selectedIndex ]) { angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' }); return; } if (!ctrl.tabs...
javascript
function updateInkBarStyles (previousTotalWidth, previousWidthOfTabItems) { if (ctrl.noInkBar) { return; } var elements = getElements(); if (!elements.tabs[ ctrl.selectedIndex ]) { angular.element(elements.inkBar).css({ left: 'auto', right: 'auto' }); return; } if (!ctrl.tabs...
[ "function", "updateInkBarStyles", "(", "previousTotalWidth", ",", "previousWidthOfTabItems", ")", "{", "if", "(", "ctrl", ".", "noInkBar", ")", "{", "return", ";", "}", "var", "elements", "=", "getElements", "(", ")", ";", "if", "(", "!", "elements", ".", ...
Repositions the ink bar to the selected tab. Parameters are used when calling itself recursively when md-center-tabs is used as we need to run two passes to properly center the tabs. These parameters ensure that we only run two passes and that we don't run indefinitely. @param {number=} previousTotalWidth previous widt...
[ "Repositions", "the", "ink", "bar", "to", "the", "selected", "tab", ".", "Parameters", "are", "used", "when", "calling", "itself", "recursively", "when", "md", "-", "center", "-", "tabs", "is", "used", "as", "we", "need", "to", "run", "two", "passes", "t...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L861-L902
train
angular/material
src/components/tabs/js/tabsController.js
attachRipple
function attachRipple (scope, element) { var elements = getElements(); var options = { colorElement: angular.element(elements.inkBar) }; $mdTabInkRipple.attach(scope, element, options); }
javascript
function attachRipple (scope, element) { var elements = getElements(); var options = { colorElement: angular.element(elements.inkBar) }; $mdTabInkRipple.attach(scope, element, options); }
[ "function", "attachRipple", "(", "scope", ",", "element", ")", "{", "var", "elements", "=", "getElements", "(", ")", ";", "var", "options", "=", "{", "colorElement", ":", "angular", ".", "element", "(", "elements", ".", "inkBar", ")", "}", ";", "$mdTabIn...
Attaches a ripple to the tab item element. @param scope @param element
[ "Attaches", "a", "ripple", "to", "the", "tab", "item", "element", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L947-L951
train
angular/material
src/components/tabs/js/tabsController.js
setAriaControls
function setAriaControls (tab) { if (tab.hasContent) { var nodes = $element[0].querySelectorAll('[md-tab-id="' + tab.id + '"]'); angular.element(nodes).attr('aria-controls', ctrl.tabContentPrefix + tab.id); } }
javascript
function setAriaControls (tab) { if (tab.hasContent) { var nodes = $element[0].querySelectorAll('[md-tab-id="' + tab.id + '"]'); angular.element(nodes).attr('aria-controls', ctrl.tabContentPrefix + tab.id); } }
[ "function", "setAriaControls", "(", "tab", ")", "{", "if", "(", "tab", ".", "hasContent", ")", "{", "var", "nodes", "=", "$element", "[", "0", "]", ".", "querySelectorAll", "(", "'[md-tab-id=\"'", "+", "tab", ".", "id", "+", "'\"]'", ")", ";", "angular...
Sets the `aria-controls` attribute to the elements that correspond to the passed-in tab. @param tab
[ "Sets", "the", "aria", "-", "controls", "attribute", "to", "the", "elements", "that", "correspond", "to", "the", "passed", "-", "in", "tab", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/js/tabsController.js#L957-L962
train
angular/material
src/components/list/list.js
copyAttributes
function copyAttributes(source, destination, extraAttrs) { var copiedAttrs = $mdUtil.prefixer([ 'ng-if', 'ng-click', 'ng-dblclick', 'aria-label', 'ng-disabled', 'ui-sref', 'href', 'ng-href', 'rel', 'target', 'ng-attr-ui-sref', 'ui-sref-opts', 'download' ]); if (extraAttrs) {...
javascript
function copyAttributes(source, destination, extraAttrs) { var copiedAttrs = $mdUtil.prefixer([ 'ng-if', 'ng-click', 'ng-dblclick', 'aria-label', 'ng-disabled', 'ui-sref', 'href', 'ng-href', 'rel', 'target', 'ng-attr-ui-sref', 'ui-sref-opts', 'download' ]); if (extraAttrs) {...
[ "function", "copyAttributes", "(", "source", ",", "destination", ",", "extraAttrs", ")", "{", "var", "copiedAttrs", "=", "$mdUtil", ".", "prefixer", "(", "[", "'ng-if'", ",", "'ng-click'", ",", "'ng-dblclick'", ",", "'aria-label'", ",", "'ng-disabled'", ",", "...
Copies attributes from a source element to the destination element By default the function will copy the most necessary attributes, supported by the button executor for clickable list items. @param source Element with the specified attributes @param destination Element which will retrieve the attributes @param extraAtt...
[ "Copies", "attributes", "from", "a", "source", "element", "to", "the", "destination", "element", "By", "default", "the", "function", "will", "copy", "the", "most", "necessary", "attributes", "supported", "by", "the", "button", "executor", "for", "clickable", "li...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/list/list.js#L406-L422
train
angular/material
src/core/services/ripple/ripple.js
InkRippleCtrl
function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdUtil, $mdColorUtil) { this.$window = $window; this.$timeout = $timeout; this.$mdUtil = $mdUtil; this.$mdColorUtil = $mdColorUtil; this.$scope = $scope; this.$element = $element; this.options = rippleOptions;...
javascript
function InkRippleCtrl ($scope, $element, rippleOptions, $window, $timeout, $mdUtil, $mdColorUtil) { this.$window = $window; this.$timeout = $timeout; this.$mdUtil = $mdUtil; this.$mdColorUtil = $mdColorUtil; this.$scope = $scope; this.$element = $element; this.options = rippleOptions;...
[ "function", "InkRippleCtrl", "(", "$scope", ",", "$element", ",", "rippleOptions", ",", "$window", ",", "$timeout", ",", "$mdUtil", ",", "$mdColorUtil", ")", "{", "this", ".", "$window", "=", "$window", ";", "this", ".", "$timeout", "=", "$timeout", ";", "...
Controller used by the ripple service in order to apply ripples @ngInject
[ "Controller", "used", "by", "the", "ripple", "service", "in", "order", "to", "apply", "ripples" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/ripple/ripple.js#L158-L180
train
angular/material
src/core/services/ripple/ripple.js
getElementColor
function getElementColor () { var items = self.options && self.options.colorElement ? self.options.colorElement : []; var elem = items.length ? items[ 0 ] : self.$element[ 0 ]; return elem ? self.$window.getComputedStyle(elem).color : 'rgb(0,0,0)'; }
javascript
function getElementColor () { var items = self.options && self.options.colorElement ? self.options.colorElement : []; var elem = items.length ? items[ 0 ] : self.$element[ 0 ]; return elem ? self.$window.getComputedStyle(elem).color : 'rgb(0,0,0)'; }
[ "function", "getElementColor", "(", ")", "{", "var", "items", "=", "self", ".", "options", "&&", "self", ".", "options", ".", "colorElement", "?", "self", ".", "options", ".", "colorElement", ":", "[", "]", ";", "var", "elem", "=", "items", ".", "lengt...
Finds the color element and returns its text color for use as default ripple color @returns {string}
[ "Finds", "the", "color", "element", "and", "returns", "its", "text", "color", "for", "use", "as", "default", "ripple", "color" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/ripple/ripple.js#L214-L219
train
angular/material
src/components/datepicker/js/dateLocaleProvider.js
defaultFormatDate
function defaultFormatDate(date, timezone) { if (!date) { return ''; } // All of the dates created through ng-material *should* be set to midnight. // If we encounter a date where the localeTime shows at 11pm instead of midnight, // we have run into an issue with DST w...
javascript
function defaultFormatDate(date, timezone) { if (!date) { return ''; } // All of the dates created through ng-material *should* be set to midnight. // If we encounter a date where the localeTime shows at 11pm instead of midnight, // we have run into an issue with DST w...
[ "function", "defaultFormatDate", "(", "date", ",", "timezone", ")", "{", "if", "(", "!", "date", ")", "{", "return", "''", ";", "}", "// All of the dates created through ng-material *should* be set to midnight.", "// If we encounter a date where the localeTime shows at 11pm ins...
Default date-to-string formatting function. @param {!Date} date @param {string=} timezone @returns {string}
[ "Default", "date", "-", "to", "-", "string", "formatting", "function", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateLocaleProvider.js#L195-L213
train
angular/material
src/components/datepicker/js/dateLocaleProvider.js
defaultLongDateFormatter
function defaultLongDateFormatter(date) { // Example: 'Thursday June 18 2015' return [ service.days[date.getDay()], service.months[date.getMonth()], service.dates[date.getDate()], date.getFullYear() ].join(' '); }
javascript
function defaultLongDateFormatter(date) { // Example: 'Thursday June 18 2015' return [ service.days[date.getDay()], service.months[date.getMonth()], service.dates[date.getDate()], date.getFullYear() ].join(' '); }
[ "function", "defaultLongDateFormatter", "(", "date", ")", "{", "// Example: 'Thursday June 18 2015'", "return", "[", "service", ".", "days", "[", "date", ".", "getDay", "(", ")", "]", ",", "service", ".", "months", "[", "date", ".", "getMonth", "(", ")", "]"...
Default formatter for date cell aria-labels. @param {!Date} date @returns {string}
[ "Default", "formatter", "for", "date", "cell", "aria", "-", "labels", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/dateLocaleProvider.js#L274-L282
train
angular/material
src/components/datepicker/js/calendarMonth.js
calendarDirective
function calendarDirective() { return { template: '<table aria-hidden="true" class="md-calendar-day-header"><thead></thead></table>' + '<div class="md-calendar-scroll-mask">' + '<md-virtual-repeat-container class="md-calendar-scroll-container" ' + 'md-offset-size="' + (TB...
javascript
function calendarDirective() { return { template: '<table aria-hidden="true" class="md-calendar-day-header"><thead></thead></table>' + '<div class="md-calendar-scroll-mask">' + '<md-virtual-repeat-container class="md-calendar-scroll-container" ' + 'md-offset-size="' + (TB...
[ "function", "calendarDirective", "(", ")", "{", "return", "{", "template", ":", "'<table aria-hidden=\"true\" class=\"md-calendar-day-header\"><thead></thead></table>'", "+", "'<div class=\"md-calendar-scroll-mask\">'", "+", "'<md-virtual-repeat-container class=\"md-calendar-scroll-contain...
Private directive that represents a list of months inside the calendar.
[ "Private", "directive", "that", "represents", "a", "list", "of", "months", "inside", "the", "calendar", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonth.js#L20-L55
train
angular/material
src/components/datepicker/js/calendarMonth.js
CalendarMonthCtrl
function CalendarMonthCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdDateLocale) { /** @final {!angular.JQLite} */ this.$element = $element; /** @final {!angular.Scope} */ this.$scope = $scope; /** @final {!angular.$animate} */ this.$animate = $animate; /** @final {!angular.$q...
javascript
function CalendarMonthCtrl($element, $scope, $animate, $q, $$mdDateUtil, $mdDateLocale) { /** @final {!angular.JQLite} */ this.$element = $element; /** @final {!angular.Scope} */ this.$scope = $scope; /** @final {!angular.$animate} */ this.$animate = $animate; /** @final {!angular.$q...
[ "function", "CalendarMonthCtrl", "(", "$element", ",", "$scope", ",", "$animate", ",", "$q", ",", "$$mdDateUtil", ",", "$mdDateLocale", ")", "{", "/** @final {!angular.JQLite} */", "this", ".", "$element", "=", "$element", ";", "/** @final {!angular.Scope} */", "this"...
Controller for the calendar month component. @ngInject @constructor
[ "Controller", "for", "the", "calendar", "month", "component", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarMonth.js#L61-L113
train
angular/material
src/components/navBar/navBar.js
MdNavItemController
function MdNavItemController($element) { /** @private @const {!angular.JQLite} */ this._$element = $element; // Data-bound variables /** @const {?Function} */ this.mdNavClick; /** @const {?string} */ this.mdNavHref; /** @const {?string} */ this.mdNavSref; /** @const {?Object} */ this.srefOpts...
javascript
function MdNavItemController($element) { /** @private @const {!angular.JQLite} */ this._$element = $element; // Data-bound variables /** @const {?Function} */ this.mdNavClick; /** @const {?string} */ this.mdNavHref; /** @const {?string} */ this.mdNavSref; /** @const {?Object} */ this.srefOpts...
[ "function", "MdNavItemController", "(", "$element", ")", "{", "/** @private @const {!angular.JQLite} */", "this", ".", "_$element", "=", "$element", ";", "// Data-bound variables", "/** @const {?Function} */", "this", ".", "mdNavClick", ";", "/** @const {?string} */", "this",...
Controller for the nav-item component. @param {!angular.JQLite} $element @constructor @final @ngInject
[ "Controller", "for", "the", "nav", "-", "item", "component", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/navBar/navBar.js#L652-L681
train
angular/material
src/core/services/meta/meta.js
mapExistingElement
function mapExistingElement(name) { if (metaElements[name]) { return true; } var element = document.getElementsByName(name)[0]; if (!element) { return false; } metaElements[name] = angular.element(element); return true; }
javascript
function mapExistingElement(name) { if (metaElements[name]) { return true; } var element = document.getElementsByName(name)[0]; if (!element) { return false; } metaElements[name] = angular.element(element); return true; }
[ "function", "mapExistingElement", "(", "name", ")", "{", "if", "(", "metaElements", "[", "name", "]", ")", "{", "return", "true", ";", "}", "var", "element", "=", "document", ".", "getElementsByName", "(", "name", ")", "[", "0", "]", ";", "if", "(", ...
Checks if the requested element was written manually and maps it @param {string} name meta tag 'name' attribute value @returns {boolean} returns true if there is an element with the requested name
[ "Checks", "if", "the", "requested", "element", "was", "written", "manually", "and", "maps", "it" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/meta/meta.js#L44-L58
train
angular/material
src/components/chips/demoContactChips/script.js
delayedQuerySearch
function delayedQuerySearch(criteria) { if (!pendingSearch || !debounceSearch()) { cancelSearch(); return pendingSearch = $q(function(resolve, reject) { // Simulate async search... (after debouncing) cancelSearch = reject; $timeout(function() { resolve(...
javascript
function delayedQuerySearch(criteria) { if (!pendingSearch || !debounceSearch()) { cancelSearch(); return pendingSearch = $q(function(resolve, reject) { // Simulate async search... (after debouncing) cancelSearch = reject; $timeout(function() { resolve(...
[ "function", "delayedQuerySearch", "(", "criteria", ")", "{", "if", "(", "!", "pendingSearch", "||", "!", "debounceSearch", "(", ")", ")", "{", "cancelSearch", "(", ")", ";", "return", "pendingSearch", "=", "$q", "(", "function", "(", "resolve", ",", "rejec...
Async search for contacts Also debounce the queries; since the md-contact-chips does not support this
[ "Async", "search", "for", "contacts", "Also", "debounce", "the", "queries", ";", "since", "the", "md", "-", "contact", "-", "chips", "does", "not", "support", "this" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/chips/demoContactChips/script.js#L41-L58
train
angular/material
src/components/chips/js/contactChipsDirective.js
MdContactChips
function MdContactChips($mdTheming, $mdUtil) { return { template: function(element, attrs) { return MD_CONTACT_CHIPS_TEMPLATE; }, restrict: 'E', controller: 'MdContactChipsCtrl', controllerAs: '$mdContactChipsCtrl', bindToController: true, compile: compile, scope: { contact...
javascript
function MdContactChips($mdTheming, $mdUtil) { return { template: function(element, attrs) { return MD_CONTACT_CHIPS_TEMPLATE; }, restrict: 'E', controller: 'MdContactChipsCtrl', controllerAs: '$mdContactChipsCtrl', bindToController: true, compile: compile, scope: { contact...
[ "function", "MdContactChips", "(", "$mdTheming", ",", "$mdUtil", ")", "{", "return", "{", "template", ":", "function", "(", "element", ",", "attrs", ")", "{", "return", "MD_CONTACT_CHIPS_TEMPLATE", ";", "}", ",", "restrict", ":", "'E'", ",", "controller", ":...
MDContactChips Directive Definition @param $mdTheming @param $mdUtil @returns {*} @ngInject
[ "MDContactChips", "Directive", "Definition" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/chips/js/contactChipsDirective.js#L133-L181
train
angular/material
src/components/autocomplete/js/autocompleteDirective.js
getRepeatMode
function getRepeatMode(modeStr) { if (!modeStr) { return REPEAT_VIRTUAL; } modeStr = modeStr.toLowerCase(); return REPEAT_MODES.indexOf(modeStr) > -1 ? modeStr : REPEAT_VIRTUAL; }
javascript
function getRepeatMode(modeStr) { if (!modeStr) { return REPEAT_VIRTUAL; } modeStr = modeStr.toLowerCase(); return REPEAT_MODES.indexOf(modeStr) > -1 ? modeStr : REPEAT_VIRTUAL; }
[ "function", "getRepeatMode", "(", "modeStr", ")", "{", "if", "(", "!", "modeStr", ")", "{", "return", "REPEAT_VIRTUAL", ";", "}", "modeStr", "=", "modeStr", ".", "toLowerCase", "(", ")", ";", "return", "REPEAT_MODES", ".", "indexOf", "(", "modeStr", ")", ...
get a valid repeat mode from an md-mode attribute string.
[ "get", "a", "valid", "repeat", "mode", "from", "an", "md", "-", "mode", "attribute", "string", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteDirective.js#L298-L302
train
angular/material
src/core/util/util.js
function (target, key, expectedVal) { var hasValue = false; if (target && target.length) { var computedStyles = $window.getComputedStyle(target[0]); hasValue = angular.isDefined(computedStyles[key]) && (expectedVal ? computedStyles[key] == expectedVal : true); } return hasValue; }
javascript
function (target, key, expectedVal) { var hasValue = false; if (target && target.length) { var computedStyles = $window.getComputedStyle(target[0]); hasValue = angular.isDefined(computedStyles[key]) && (expectedVal ? computedStyles[key] == expectedVal : true); } return hasValue; }
[ "function", "(", "target", ",", "key", ",", "expectedVal", ")", "{", "var", "hasValue", "=", "false", ";", "if", "(", "target", "&&", "target", ".", "length", ")", "{", "var", "computedStyles", "=", "$window", ".", "getComputedStyle", "(", "target", "[",...
Checks if the target element has the requested style by key @param {DOMElement|JQLite} target Target element @param {string} key Style key @param {string=} expectedVal Optional expected value @returns {boolean} Whether the target element has the style or not
[ "Checks", "if", "the", "target", "element", "has", "the", "requested", "style", "by", "key" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L35-L44
train
angular/material
src/core/util/util.js
function(nodes) { nodes = nodes || []; var results = []; for (var i = 0; i < nodes.length; ++i) { results.push(nodes.item(i)); } return results; }
javascript
function(nodes) { nodes = nodes || []; var results = []; for (var i = 0; i < nodes.length; ++i) { results.push(nodes.item(i)); } return results; }
[ "function", "(", "nodes", ")", "{", "nodes", "=", "nodes", "||", "[", "]", ";", "var", "results", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "nodes", ".", "length", ";", "++", "i", ")", "{", "results", ".", "push", ...
Annoying method to copy nodes to an array, thanks to IE
[ "Annoying", "method", "to", "copy", "nodes", "to", "an", "array", "thanks", "to", "IE" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L144-L152
train
angular/material
src/core/util/util.js
function(containerEl, attributeVal) { var AUTO_FOCUS = this.prefixer('md-autofocus', true); var elToFocus; elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); if (!elToFocus && attributeVal != AUTO_FOCUS) { // Scan for deprecated attribute elToFocus = scanFor...
javascript
function(containerEl, attributeVal) { var AUTO_FOCUS = this.prefixer('md-autofocus', true); var elToFocus; elToFocus = scanForFocusable(containerEl, attributeVal || AUTO_FOCUS); if (!elToFocus && attributeVal != AUTO_FOCUS) { // Scan for deprecated attribute elToFocus = scanFor...
[ "function", "(", "containerEl", ",", "attributeVal", ")", "{", "var", "AUTO_FOCUS", "=", "this", ".", "prefixer", "(", "'md-autofocus'", ",", "true", ")", ";", "var", "elToFocus", ";", "elToFocus", "=", "scanForFocusable", "(", "containerEl", ",", "attributeVa...
Finds the proper focus target by searching the DOM. @param containerEl @param attributeVal @returns {*}
[ "Finds", "the", "proper", "focus", "target", "by", "searching", "the", "DOM", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L176-L214
train
angular/material
src/core/util/util.js
disableElementScroll
function disableElementScroll(element) { element = angular.element(element || body); var scrollMask; if (options.disableScrollMask) { scrollMask = element; } else { scrollMask = angular.element( '<div class="md-scroll-mask">' + ' <div class=...
javascript
function disableElementScroll(element) { element = angular.element(element || body); var scrollMask; if (options.disableScrollMask) { scrollMask = element; } else { scrollMask = angular.element( '<div class="md-scroll-mask">' + ' <div class=...
[ "function", "disableElementScroll", "(", "element", ")", "{", "element", "=", "angular", ".", "element", "(", "element", "||", "body", ")", ";", "var", "scrollMask", ";", "if", "(", "options", ".", "disableScrollMask", ")", "{", "scrollMask", "=", "element",...
Creates a virtual scrolling mask to prevent touchmove, keyboard, scrollbar clicking, and wheel events
[ "Creates", "a", "virtual", "scrolling", "mask", "to", "prevent", "touchmove", "keyboard", "scrollbar", "clicking", "and", "wheel", "events" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L252-L282
train
angular/material
src/core/util/util.js
disableBodyScroll
function disableBodyScroll() { var documentElement = $document[0].documentElement; var prevDocumentStyle = documentElement.style.cssText || ''; var prevBodyStyle = body.style.cssText || ''; var viewportTop = $mdUtil.getViewportTop(); $mdUtil.disableScrollAround._viewPortTop = v...
javascript
function disableBodyScroll() { var documentElement = $document[0].documentElement; var prevDocumentStyle = documentElement.style.cssText || ''; var prevBodyStyle = body.style.cssText || ''; var viewportTop = $mdUtil.getViewportTop(); $mdUtil.disableScrollAround._viewPortTop = v...
[ "function", "disableBodyScroll", "(", ")", "{", "var", "documentElement", "=", "$document", "[", "0", "]", ".", "documentElement", ";", "var", "prevDocumentStyle", "=", "documentElement", ".", "style", ".", "cssText", "||", "''", ";", "var", "prevBodyStyle", "...
Converts the body to a position fixed block and translate it to the proper scroll position
[ "Converts", "the", "body", "to", "a", "position", "fixed", "block", "and", "translate", "it", "to", "the", "proper", "scroll", "position" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L285-L321
train
angular/material
src/core/util/util.js
function(element) { var node = element[0] || element; document.addEventListener('click', function focusOnClick(ev) { if (ev.target === node && ev.$focus) { node.focus(); ev.stopImmediatePropagation(); ev.preventDefault(); node.removeEventListener('click', foc...
javascript
function(element) { var node = element[0] || element; document.addEventListener('click', function focusOnClick(ev) { if (ev.target === node && ev.$focus) { node.focus(); ev.stopImmediatePropagation(); ev.preventDefault(); node.removeEventListener('click', foc...
[ "function", "(", "element", ")", "{", "var", "node", "=", "element", "[", "0", "]", "||", "element", ";", "document", ".", "addEventListener", "(", "'click'", ",", "function", "focusOnClick", "(", "ev", ")", "{", "if", "(", "ev", ".", "target", "===", ...
Mobile safari only allows you to set focus in click event listeners...
[ "Mobile", "safari", "only", "allows", "you", "to", "set", "focus", "in", "click", "event", "listeners", "..." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L349-L367
train
angular/material
src/core/util/util.js
throttle
function throttle(func, delay) { var recent; return function throttled() { var context = this; var args = arguments; var now = $mdUtil.now(); if (!recent || (now - recent > delay)) { func.apply(context, args); recent = now; } }; }
javascript
function throttle(func, delay) { var recent; return function throttled() { var context = this; var args = arguments; var now = $mdUtil.now(); if (!recent || (now - recent > delay)) { func.apply(context, args); recent = now; } }; }
[ "function", "throttle", "(", "func", ",", "delay", ")", "{", "var", "recent", ";", "return", "function", "throttled", "(", ")", "{", "var", "context", "=", "this", ";", "var", "args", "=", "arguments", ";", "var", "now", "=", "$mdUtil", ".", "now", "...
Returns a function that can only be triggered every `delay` milliseconds. In other words, the function will not be called unless it has been more than `delay` milliseconds since the last call.
[ "Returns", "a", "function", "that", "can", "only", "be", "triggered", "every", "delay", "milliseconds", ".", "In", "other", "words", "the", "function", "will", "not", "be", "called", "unless", "it", "has", "been", "more", "than", "delay", "milliseconds", "si...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L447-L459
train
angular/material
src/core/util/util.js
reconnectScope
function reconnectScope(scope) { if (!scope) return; // we can't disconnect the root node or scope already disconnected if (scope.$root === scope) return; if (!scope.$$disconnected) return; var child = scope; var parent = child.$parent; child.$$disconnected = false; //...
javascript
function reconnectScope(scope) { if (!scope) return; // we can't disconnect the root node or scope already disconnected if (scope.$root === scope) return; if (!scope.$$disconnected) return; var child = scope; var parent = child.$parent; child.$$disconnected = false; //...
[ "function", "reconnectScope", "(", "scope", ")", "{", "if", "(", "!", "scope", ")", "return", ";", "// we can't disconnect the root node or scope already disconnected", "if", "(", "scope", ".", "$root", "===", "scope", ")", "return", ";", "if", "(", "!", "scope"...
Undo the effects of disconnectScope above.
[ "Undo", "the", "effects", "of", "disconnectScope", "above", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L519-L538
train
angular/material
src/core/util/util.js
scanChildren
function scanChildren(element) { var found; if (element) { for (var i = 0, len = element.length; i < len; i++) { var target = element[i]; if (!found) { for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { found = found ...
javascript
function scanChildren(element) { var found; if (element) { for (var i = 0, len = element.length; i < len; i++) { var target = element[i]; if (!found) { for (var j = 0, numChild = target.childNodes.length; j < numChild; j++) { found = found ...
[ "function", "scanChildren", "(", "element", ")", "{", "var", "found", ";", "if", "(", "element", ")", "{", "for", "(", "var", "i", "=", "0", ",", "len", "=", "element", ".", "length", ";", "i", "<", "len", ";", "i", "++", ")", "{", "var", "targ...
Scan children of specified node
[ "Scan", "children", "of", "specified", "node" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L629-L642
train
angular/material
src/core/util/util.js
function(scope, attr, defaults) { defaults = defaults || {}; angular.forEach(scope.$$isolateBindings, function(binding, key) { if (binding.optional && angular.isUndefined(scope[key])) { var attrIsDefined = angular.isDefined(attr[binding.attrName]); scope[key] = angular.isDefined(...
javascript
function(scope, attr, defaults) { defaults = defaults || {}; angular.forEach(scope.$$isolateBindings, function(binding, key) { if (binding.optional && angular.isUndefined(scope[key])) { var attrIsDefined = angular.isDefined(attr[binding.attrName]); scope[key] = angular.isDefined(...
[ "function", "(", "scope", ",", "attr", ",", "defaults", ")", "{", "defaults", "=", "defaults", "||", "{", "}", ";", "angular", ".", "forEach", "(", "scope", ".", "$$isolateBindings", ",", "function", "(", "binding", ",", "key", ")", "{", "if", "(", "...
Give optional properties with no value a boolean true if attr provided or false otherwise
[ "Give", "optional", "properties", "with", "no", "value", "a", "boolean", "true", "if", "attr", "provided", "or", "false", "otherwise" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L649-L657
train
angular/material
src/core/util/util.js
processQueue
function processQueue() { var queue = nextTick.queue; var digest = nextTick.digest; nextTick.queue = []; nextTick.timeout = null; nextTick.digest = false; queue.forEach(function(queueItem) { var skip = queueItem.scope && queueItem.scope.$$destroyed; ...
javascript
function processQueue() { var queue = nextTick.queue; var digest = nextTick.digest; nextTick.queue = []; nextTick.timeout = null; nextTick.digest = false; queue.forEach(function(queueItem) { var skip = queueItem.scope && queueItem.scope.$$destroyed; ...
[ "function", "processQueue", "(", ")", "{", "var", "queue", "=", "nextTick", ".", "queue", ";", "var", "digest", "=", "nextTick", ".", "digest", ";", "nextTick", ".", "queue", "=", "[", "]", ";", "nextTick", ".", "timeout", "=", "null", ";", "nextTick",...
Grab a copy of the current queue Clear the queue for future use Process the existing queue Trigger digest if necessary
[ "Grab", "a", "copy", "of", "the", "current", "queue", "Clear", "the", "queue", "for", "future", "use", "Process", "the", "existing", "queue", "Trigger", "digest", "if", "necessary" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L695-L711
train
angular/material
src/core/util/util.js
function (element) { var parent = element.parent(); // jqLite might return a non-null, but still empty, parent; so check for parent and length while (hasComputedStyle(parent, 'pointer-events', 'none')) { parent = parent.parent(); } return parent; }
javascript
function (element) { var parent = element.parent(); // jqLite might return a non-null, but still empty, parent; so check for parent and length while (hasComputedStyle(parent, 'pointer-events', 'none')) { parent = parent.parent(); } return parent; }
[ "function", "(", "element", ")", "{", "var", "parent", "=", "element", ".", "parent", "(", ")", ";", "// jqLite might return a non-null, but still empty, parent; so check for parent and length", "while", "(", "hasComputedStyle", "(", "parent", ",", "'pointer-events'", ","...
Scan up dom hierarchy for enabled parent;
[ "Scan", "up", "dom", "hierarchy", "for", "enabled", "parent", ";" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L733-L742
train
angular/material
src/core/util/util.js
function() { var stickyProp; var testEl = angular.element('<div>'); $document[0].body.appendChild(testEl[0]); var stickyProps = ['sticky', '-webkit-sticky']; for (var i = 0; i < stickyProps.length; ++i) { testEl.css({ position: stickyProps[i], top: 0, ...
javascript
function() { var stickyProp; var testEl = angular.element('<div>'); $document[0].body.appendChild(testEl[0]); var stickyProps = ['sticky', '-webkit-sticky']; for (var i = 0; i < stickyProps.length; ++i) { testEl.css({ position: stickyProps[i], top: 0, ...
[ "function", "(", ")", "{", "var", "stickyProp", ";", "var", "testEl", "=", "angular", ".", "element", "(", "'<div>'", ")", ";", "$document", "[", "0", "]", ".", "body", ".", "appendChild", "(", "testEl", "[", "0", "]", ")", ";", "var", "stickyProps",...
Checks if the current browser is natively supporting the `sticky` position. @returns {string} supported sticky property name
[ "Checks", "if", "the", "current", "browser", "is", "natively", "supporting", "the", "sticky", "position", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L757-L779
train
angular/material
src/core/util/util.js
function(element) { var parent = $mdUtil.getClosest(element, 'form'); var form = parent ? angular.element(parent).controller('form') : null; return form ? form.$submitted : false; }
javascript
function(element) { var parent = $mdUtil.getClosest(element, 'form'); var form = parent ? angular.element(parent).controller('form') : null; return form ? form.$submitted : false; }
[ "function", "(", "element", ")", "{", "var", "parent", "=", "$mdUtil", ".", "getClosest", "(", "element", ",", "'form'", ")", ";", "var", "form", "=", "parent", "?", "angular", ".", "element", "(", "parent", ")", ".", "controller", "(", "'form'", ")", ...
Returns true if the parent form of the element has been submitted. @param element An AngularJS or HTML5 element. @returns {boolean}
[ "Returns", "true", "if", "the", "parent", "form", "of", "the", "element", "has", "been", "submitted", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L803-L808
train
angular/material
src/core/util/util.js
function(element, scrollEnd, duration) { var scrollStart = element.scrollTop; var scrollChange = scrollEnd - scrollStart; var scrollingDown = scrollStart < scrollEnd; var startTime = $mdUtil.now(); $$rAF(scrollChunk); function scrollChunk() { var newPosition = calculateNewP...
javascript
function(element, scrollEnd, duration) { var scrollStart = element.scrollTop; var scrollChange = scrollEnd - scrollStart; var scrollingDown = scrollStart < scrollEnd; var startTime = $mdUtil.now(); $$rAF(scrollChunk); function scrollChunk() { var newPosition = calculateNewP...
[ "function", "(", "element", ",", "scrollEnd", ",", "duration", ")", "{", "var", "scrollStart", "=", "element", ".", "scrollTop", ";", "var", "scrollChange", "=", "scrollEnd", "-", "scrollStart", ";", "var", "scrollingDown", "=", "scrollStart", "<", "scrollEnd"...
Animate the requested element's scrollTop to the requested scrollPosition with basic easing. @param {!Element} element The element to scroll. @param {number} scrollEnd The new/final scroll position. @param {number=} duration Duration of the scroll. Default is 1000ms.
[ "Animate", "the", "requested", "element", "s", "scrollTop", "to", "the", "requested", "scrollPosition", "with", "basic", "easing", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L817-L854
train
angular/material
src/core/util/util.js
function(array) { if (!array) { return; } return array.filter(function(value, index, self) { return self.indexOf(value) === index; }); }
javascript
function(array) { if (!array) { return; } return array.filter(function(value, index, self) { return self.indexOf(value) === index; }); }
[ "function", "(", "array", ")", "{", "if", "(", "!", "array", ")", "{", "return", ";", "}", "return", "array", ".", "filter", "(", "function", "(", "value", ",", "index", ",", "self", ")", "{", "return", "self", ".", "indexOf", "(", "value", ")", ...
Provides an easy mechanism for removing duplicates from an array. var myArray = [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]; $mdUtil.uniq(myArray) => [1, 2, 3, 4] @param {array} array The array whose unique values should be returned. @returns {array} A copy of the array containing only unique values.
[ "Provides", "an", "easy", "mechanism", "for", "removing", "duplicates", "from", "an", "array", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L867-L873
train
angular/material
src/core/util/util.js
function(element) { // For SVG or Symbol elements, innerHTML returns `undefined` in IE. // Reference: https://stackoverflow.com/q/28129956/633107 // The XMLSerializer API is supported on IE11 and is the recommended workaround. var serializer = new XMLSerializer(); return Array.prototype.m...
javascript
function(element) { // For SVG or Symbol elements, innerHTML returns `undefined` in IE. // Reference: https://stackoverflow.com/q/28129956/633107 // The XMLSerializer API is supported on IE11 and is the recommended workaround. var serializer = new XMLSerializer(); return Array.prototype.m...
[ "function", "(", "element", ")", "{", "// For SVG or Symbol elements, innerHTML returns `undefined` in IE.", "// Reference: https://stackoverflow.com/q/28129956/633107", "// The XMLSerializer API is supported on IE11 and is the recommended workaround.", "var", "serializer", "=", "new", "XMLS...
Gets the inner HTML content of the given HTMLElement. Only intended for use with SVG or Symbol elements in IE11. @param {Element} element @returns {string} the inner HTML of the element passed in
[ "Gets", "the", "inner", "HTML", "content", "of", "the", "given", "HTMLElement", ".", "Only", "intended", "for", "use", "with", "SVG", "or", "Symbol", "elements", "in", "IE11", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/util.js#L881-L890
train
angular/material
src/components/autocomplete/autocomplete.spec.js
fakeItemMatch
function fakeItemMatch() { var matches = []; for (var i = 0; i < dropdownItems; i++) { matches.push('Item ' + i); } return matches; }
javascript
function fakeItemMatch() { var matches = []; for (var i = 0; i < dropdownItems; i++) { matches.push('Item ' + i); } return matches; }
[ "function", "fakeItemMatch", "(", ")", "{", "var", "matches", "=", "[", "]", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "dropdownItems", ";", "i", "++", ")", "{", "matches", ".", "push", "(", "'Item '", "+", "i", ")", ";", "}", "retu...
Function to create fake matches with the given dropdown items. Useful when running tests against the dropdown max items calculations. @returns {Array} Fake matches.
[ "Function", "to", "create", "fake", "matches", "with", "the", "given", "dropdown", "items", ".", "Useful", "when", "running", "tests", "against", "the", "dropdown", "max", "items", "calculations", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/autocomplete.spec.js#L2456-L2464
train
angular/material
src/components/input/input.js
calculateInputValueLength
function calculateInputValueLength(value) { value = ngTrim && !isPasswordInput && angular.isString(value) ? value.trim() : value; if (value === undefined || value === null) { value = ''; } return String(value).length; }
javascript
function calculateInputValueLength(value) { value = ngTrim && !isPasswordInput && angular.isString(value) ? value.trim() : value; if (value === undefined || value === null) { value = ''; } return String(value).length; }
[ "function", "calculateInputValueLength", "(", "value", ")", "{", "value", "=", "ngTrim", "&&", "!", "isPasswordInput", "&&", "angular", ".", "isString", "(", "value", ")", "?", "value", ".", "trim", "(", ")", ":", "value", ";", "if", "(", "value", "===",...
Calculate the input value's length after coercing it to a string and trimming it if appropriate. @param value {*} the input's value @returns {number} calculated length of the input's value
[ "Calculate", "the", "input", "value", "s", "length", "after", "coercing", "it", "to", "a", "string", "and", "trimming", "it", "if", "appropriate", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/input/input.js#L733-L739
train
angular/material
src/components/datepicker/js/calendarYear.js
calendarDirective
function calendarDirective() { return { template: '<div class="md-calendar-scroll-mask">' + '<md-virtual-repeat-container class="md-calendar-scroll-container">' + '<table role="grid" tabindex="0" class="md-calendar" aria-readonly="true">' + '<tbody ' + ...
javascript
function calendarDirective() { return { template: '<div class="md-calendar-scroll-mask">' + '<md-virtual-repeat-container class="md-calendar-scroll-container">' + '<table role="grid" tabindex="0" class="md-calendar" aria-readonly="true">' + '<tbody ' + ...
[ "function", "calendarDirective", "(", ")", "{", "return", "{", "template", ":", "'<div class=\"md-calendar-scroll-mask\">'", "+", "'<md-virtual-repeat-container class=\"md-calendar-scroll-container\">'", "+", "'<table role=\"grid\" tabindex=\"0\" class=\"md-calendar\" aria-readonly=\"true\...
Private component, representing a list of years in the calendar.
[ "Private", "component", "representing", "a", "list", "of", "years", "in", "the", "calendar", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendarYear.js#L14-L44
train
angular/material
src/components/panel/panel.js
definePreset
function definePreset(name, preset) { if (!name || !preset) { throw new Error('mdPanelProvider: The panel preset definition is ' + 'malformed. The name and preset object are required.'); } else if (_presets.hasOwnProperty(name)) { throw new Error('mdPanelProvider: The panel preset you have requested...
javascript
function definePreset(name, preset) { if (!name || !preset) { throw new Error('mdPanelProvider: The panel preset definition is ' + 'malformed. The name and preset object are required.'); } else if (_presets.hasOwnProperty(name)) { throw new Error('mdPanelProvider: The panel preset you have requested...
[ "function", "definePreset", "(", "name", ",", "preset", ")", "{", "if", "(", "!", "name", "||", "!", "preset", ")", "{", "throw", "new", "Error", "(", "'mdPanelProvider: The panel preset definition is '", "+", "'malformed. The name and preset object are required.'", "...
Takes the passed in panel configuration object and adds it to the `_presets` object at the specified name. @param {string} name Name of the preset to set. @param {!Object} preset Specific configuration object that can contain any and all of the parameters available within the `$mdPanel.create` method. However, paramete...
[ "Takes", "the", "passed", "in", "panel", "configuration", "object", "and", "adds", "it", "to", "the", "_presets", "object", "at", "the", "specified", "name", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.js#L966-L981
train
angular/material
src/components/panel/panel.js
getComputedTranslations
function getComputedTranslations(el, property) { // The transform being returned by `getComputedStyle` is in the format: // `matrix(a, b, c, d, translateX, translateY)` if defined and `none` // if the element doesn't have a transform. var transform = getComputedStyle(el[0] || el)[property]; var openIndex = tr...
javascript
function getComputedTranslations(el, property) { // The transform being returned by `getComputedStyle` is in the format: // `matrix(a, b, c, d, translateX, translateY)` if defined and `none` // if the element doesn't have a transform. var transform = getComputedStyle(el[0] || el)[property]; var openIndex = tr...
[ "function", "getComputedTranslations", "(", "el", ",", "property", ")", "{", "// The transform being returned by `getComputedStyle` is in the format:", "// `matrix(a, b, c, d, translateX, translateY)` if defined and `none`", "// if the element doesn't have a transform.", "var", "transform", ...
Gets the computed values for an element's translateX and translateY in px. @param {!angular.JQLite|!Element} el @param {string} property @return {{x: number, y: number}}
[ "Gets", "the", "computed", "values", "for", "an", "element", "s", "translateX", "and", "translateY", "in", "px", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/panel/panel.js#L3530-L3550
train
angular/material
docs/app/js/anchor.js
createContentURL
function createContentURL() { var path = ''; var name = element.text(); // Use $window.location.pathname to get the path with the baseURL included. // $location.path() does not include the baseURL. This is important to support how the docs // are deployed with baseURLs like /late...
javascript
function createContentURL() { var path = ''; var name = element.text(); // Use $window.location.pathname to get the path with the baseURL included. // $location.path() does not include the baseURL. This is important to support how the docs // are deployed with baseURLs like /late...
[ "function", "createContentURL", "(", ")", "{", "var", "path", "=", "''", ";", "var", "name", "=", "element", ".", "text", "(", ")", ";", "// Use $window.location.pathname to get the path with the baseURL included.", "// $location.path() does not include the baseURL. This is i...
Creates URL from the text content of the element and writes it into the scope.
[ "Creates", "URL", "from", "the", "text", "content", "of", "the", "element", "and", "writes", "it", "into", "the", "scope", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/docs/app/js/anchor.js#L43-L61
train
angular/material
src/components/autocomplete/js/autocompleteParentScopeDirective.js
watchVariable
function watchVariable(variable, alias) { newScope[alias] = scope[variable]; scope.$watch(variable, function(value) { $mdUtil.nextTick(function() { newScope[alias] = value; }); }); }
javascript
function watchVariable(variable, alias) { newScope[alias] = scope[variable]; scope.$watch(variable, function(value) { $mdUtil.nextTick(function() { newScope[alias] = value; }); }); }
[ "function", "watchVariable", "(", "variable", ",", "alias", ")", "{", "newScope", "[", "alias", "]", "=", "scope", "[", "variable", "]", ";", "scope", ".", "$watch", "(", "variable", ",", "function", "(", "value", ")", "{", "$mdUtil", ".", "nextTick", ...
Creates a watcher for variables that are copied from the parent scope @param variable @param alias
[ "Creates", "a", "watcher", "for", "variables", "that", "are", "copied", "from", "the", "parent", "scope" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteParentScopeDirective.js#L36-L44
train
angular/material
src/core/services/layout/layout.js
buildCloakInterceptor
function buildCloakInterceptor(className) { return ['$timeout', function($timeout){ return { restrict : 'A', priority : -10, // run after normal ng-cloak compile : function(element) { if (!config.enabled) return angular.noop; // Re-add the cloak elemen...
javascript
function buildCloakInterceptor(className) { return ['$timeout', function($timeout){ return { restrict : 'A', priority : -10, // run after normal ng-cloak compile : function(element) { if (!config.enabled) return angular.noop; // Re-add the cloak elemen...
[ "function", "buildCloakInterceptor", "(", "className", ")", "{", "return", "[", "'$timeout'", ",", "function", "(", "$timeout", ")", "{", "return", "{", "restrict", ":", "'A'", ",", "priority", ":", "-", "10", ",", "// run after normal ng-cloak", "compile", ":...
Tail-hook ngCloak to delay the uncloaking while Layout transformers finish processing. Eliminates flicker with Material.Layouts
[ "Tail", "-", "hook", "ngCloak", "to", "delay", "the", "uncloaking", "while", "Layout", "transformers", "finish", "processing", ".", "Eliminates", "flicker", "with", "Material", ".", "Layouts" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L215-L237
train
angular/material
src/core/services/layout/layout.js
function(element) { if (!config.enabled) return angular.noop; // Re-add the cloak element.addClass(className); return function(scope, element) { // Wait while layout injectors configure, then uncloak // NOTE: $rAF does not delay enough... and this is a 1...
javascript
function(element) { if (!config.enabled) return angular.noop; // Re-add the cloak element.addClass(className); return function(scope, element) { // Wait while layout injectors configure, then uncloak // NOTE: $rAF does not delay enough... and this is a 1...
[ "function", "(", "element", ")", "{", "if", "(", "!", "config", ".", "enabled", ")", "return", "angular", ".", "noop", ";", "// Re-add the cloak", "element", ".", "addClass", "(", "className", ")", ";", "return", "function", "(", "scope", ",", "element", ...
run after normal ng-cloak
[ "run", "after", "normal", "ng", "-", "cloak" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L220-L234
train
angular/material
src/core/services/layout/layout.js
updateClassWithValue
function updateClassWithValue(element, className) { var lastClass; return function updateClassFn(newValue) { var value = validateAttributeValue(className, newValue || ""); if (angular.isDefined(value)) { if (lastClass) element.removeClass(lastClass); lastClass = !value ? className :...
javascript
function updateClassWithValue(element, className) { var lastClass; return function updateClassFn(newValue) { var value = validateAttributeValue(className, newValue || ""); if (angular.isDefined(value)) { if (lastClass) element.removeClass(lastClass); lastClass = !value ? className :...
[ "function", "updateClassWithValue", "(", "element", ",", "className", ")", "{", "var", "lastClass", ";", "return", "function", "updateClassFn", "(", "newValue", ")", "{", "var", "value", "=", "validateAttributeValue", "(", "className", ",", "newValue", "||", "\"...
After link-phase, do NOT remove deprecated layout attribute selector. Instead watch the attribute so interpolated data-bindings to layout selectors will continue to be supported. $observe() the className and update with new class (after removing the last one) e.g. `layout="{{layoutDemo.direction}}"` will update... N...
[ "After", "link", "-", "phase", "do", "NOT", "remove", "deprecated", "layout", "attribute", "selector", ".", "Instead", "watch", "the", "attribute", "so", "interpolated", "data", "-", "bindings", "to", "layout", "selectors", "will", "continue", "to", "be", "sup...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L356-L367
train
angular/material
src/core/services/layout/layout.js
warnAttrNotSupported
function warnAttrNotSupported(className) { var parts = className.split("-"); return ["$log", function($log) { $log.warn(className + "has been deprecated. Please use a `" + parts[0] + "-gt-<xxx>` variant."); return angular.noop; }]; }
javascript
function warnAttrNotSupported(className) { var parts = className.split("-"); return ["$log", function($log) { $log.warn(className + "has been deprecated. Please use a `" + parts[0] + "-gt-<xxx>` variant."); return angular.noop; }]; }
[ "function", "warnAttrNotSupported", "(", "className", ")", "{", "var", "parts", "=", "className", ".", "split", "(", "\"-\"", ")", ";", "return", "[", "\"$log\"", ",", "function", "(", "$log", ")", "{", "$log", ".", "warn", "(", "className", "+", "\"has ...
Provide console warning that this layout attribute has been deprecated
[ "Provide", "console", "warning", "that", "this", "layout", "attribute", "has", "been", "deprecated" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L373-L379
train
angular/material
src/core/services/layout/layout.js
validateAttributeValue
function validateAttributeValue(className, value, updateFn) { var origValue; if (!needsInterpolation(value)) { switch (className.replace(SUFFIXES,"")) { case 'layout' : if (!findIn(value, LAYOUT_OPTIONS)) { value = LAYOUT_OPTIONS[0]; // 'row'; } ...
javascript
function validateAttributeValue(className, value, updateFn) { var origValue; if (!needsInterpolation(value)) { switch (className.replace(SUFFIXES,"")) { case 'layout' : if (!findIn(value, LAYOUT_OPTIONS)) { value = LAYOUT_OPTIONS[0]; // 'row'; } ...
[ "function", "validateAttributeValue", "(", "className", ",", "value", ",", "updateFn", ")", "{", "var", "origValue", ";", "if", "(", "!", "needsInterpolation", "(", "value", ")", ")", "{", "switch", "(", "className", ".", "replace", "(", "SUFFIXES", ",", "...
For the Layout attribute value, validate or replace with default fallback value
[ "For", "the", "Layout", "attribute", "value", "validate", "or", "replace", "with", "default", "fallback", "value" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L409-L455
train
angular/material
src/core/services/layout/layout.js
buildUpdateFn
function buildUpdateFn(element, className, attrs) { return function updateAttrValue(fallback) { if (!needsInterpolation(fallback)) { // Do not modify the element's attribute value; so // uses '<ui-layout layout="/api/sidebar.html" />' will not // be affected. Just update the attrs valu...
javascript
function buildUpdateFn(element, className, attrs) { return function updateAttrValue(fallback) { if (!needsInterpolation(fallback)) { // Do not modify the element's attribute value; so // uses '<ui-layout layout="/api/sidebar.html" />' will not // be affected. Just update the attrs valu...
[ "function", "buildUpdateFn", "(", "element", ",", "className", ",", "attrs", ")", "{", "return", "function", "updateAttrValue", "(", "fallback", ")", "{", "if", "(", "!", "needsInterpolation", "(", "fallback", ")", ")", "{", "// Do not modify the element's attribu...
Replace current attribute value with fallback value
[ "Replace", "current", "attribute", "value", "with", "fallback", "value" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/layout/layout.js#L460-L469
train
angular/material
src/components/slider/slider.js
positionToPercent
function positionToPercent(position) { var offset = vertical ? sliderDimensions.top : sliderDimensions.left; var size = vertical ? sliderDimensions.height : sliderDimensions.width; var calc = (position - offset) / size; if (!vertical && $mdUtil.bidi() === 'rtl') { calc = 1 - calc; ...
javascript
function positionToPercent(position) { var offset = vertical ? sliderDimensions.top : sliderDimensions.left; var size = vertical ? sliderDimensions.height : sliderDimensions.width; var calc = (position - offset) / size; if (!vertical && $mdUtil.bidi() === 'rtl') { calc = 1 - calc; ...
[ "function", "positionToPercent", "(", "position", ")", "{", "var", "offset", "=", "vertical", "?", "sliderDimensions", ".", "top", ":", "sliderDimensions", ".", "left", ";", "var", "size", "=", "vertical", "?", "sliderDimensions", ".", "height", ":", "sliderDi...
Convert position on slider to percentage value of offset from beginning... @param position @returns {number}
[ "Convert", "position", "on", "slider", "to", "percentage", "value", "of", "offset", "from", "beginning", "..." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/slider/slider.js#L645-L655
train
angular/material
src/components/slider/slider.js
percentToValue
function percentToValue(percent) { var adjustedPercent = invert ? (1 - percent) : percent; return (min + adjustedPercent * (max - min)); }
javascript
function percentToValue(percent) { var adjustedPercent = invert ? (1 - percent) : percent; return (min + adjustedPercent * (max - min)); }
[ "function", "percentToValue", "(", "percent", ")", "{", "var", "adjustedPercent", "=", "invert", "?", "(", "1", "-", "percent", ")", ":", "percent", ";", "return", "(", "min", "+", "adjustedPercent", "*", "(", "max", "-", "min", ")", ")", ";", "}" ]
Convert percentage offset on slide to equivalent model value @param percent @returns {*}
[ "Convert", "percentage", "offset", "on", "slide", "to", "equivalent", "model", "value" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/slider/slider.js#L662-L665
train
angular/material
src/core/services/aria/aria.js
expect
function expect(element, attrName, defaultValue) { var node = angular.element(element)[0] || element; // if node exists and neither it nor its children have the attribute if (node && ((!node.hasAttribute(attrName) || node.getAttribute(attrName).length === 0) && !childHasAttribute(no...
javascript
function expect(element, attrName, defaultValue) { var node = angular.element(element)[0] || element; // if node exists and neither it nor its children have the attribute if (node && ((!node.hasAttribute(attrName) || node.getAttribute(attrName).length === 0) && !childHasAttribute(no...
[ "function", "expect", "(", "element", ",", "attrName", ",", "defaultValue", ")", "{", "var", "node", "=", "angular", ".", "element", "(", "element", ")", "[", "0", "]", "||", "element", ";", "// if node exists and neither it nor its children have the attribute", "...
Check if expected attribute has been specified on the target element or child @param element @param attrName @param {optional} defaultValue What to set the attr to if no value is found
[ "Check", "if", "expected", "attribute", "has", "been", "specified", "on", "the", "target", "element", "or", "child" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/aria/aria.js#L80-L98
train
angular/material
src/core/services/aria/aria.js
hasAriaLabel
function hasAriaLabel(element) { var node = angular.element(element)[0] || element; /* Check if compatible node type (ie: not HTML Document node) */ if (!node.hasAttribute) { return false; } /* Check label or description attributes */ return node.hasAttribute('aria-label') || node.hasAtt...
javascript
function hasAriaLabel(element) { var node = angular.element(element)[0] || element; /* Check if compatible node type (ie: not HTML Document node) */ if (!node.hasAttribute) { return false; } /* Check label or description attributes */ return node.hasAttribute('aria-label') || node.hasAtt...
[ "function", "hasAriaLabel", "(", "element", ")", "{", "var", "node", "=", "angular", ".", "element", "(", "element", ")", "[", "0", "]", "||", "element", ";", "/* Check if compatible node type (ie: not HTML Document node) */", "if", "(", "!", "node", ".", "hasAt...
Check if expected element has aria label attribute @param element
[ "Check", "if", "expected", "element", "has", "aria", "label", "attribute" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/aria/aria.js#L181-L191
train
angular/material
src/core/services/aria/aria.js
parentHasAriaLabel
function parentHasAriaLabel(element, level) { level = level || 1; var node = angular.element(element)[0] || element; if (!node.parentNode) { return false; } if (performCheck(node.parentNode)) { return true; } level--; if (level) { return parentHasAriaLabel(node.parentNo...
javascript
function parentHasAriaLabel(element, level) { level = level || 1; var node = angular.element(element)[0] || element; if (!node.parentNode) { return false; } if (performCheck(node.parentNode)) { return true; } level--; if (level) { return parentHasAriaLabel(node.parentNo...
[ "function", "parentHasAriaLabel", "(", "element", ",", "level", ")", "{", "level", "=", "level", "||", "1", ";", "var", "node", "=", "angular", ".", "element", "(", "element", ")", "[", "0", "]", "||", "element", ";", "if", "(", "!", "node", ".", "...
Check if expected element's parent has aria label attribute and has valid role and tagName @param element @param {optional} level Number of levels deep search should be performed
[ "Check", "if", "expected", "element", "s", "parent", "has", "aria", "label", "attribute", "and", "has", "valid", "role", "and", "tagName" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/aria/aria.js#L198-L321
train
angular/material
src/core/util/autofocus.js
updateExpression
function updateExpression(value) { // Rather than passing undefined to the jqLite toggle class function we explicitly set the // value to true. Otherwise the class will be just toggled instead of being forced. if (angular.isUndefined(value)) { value = true; } element.toggleClass(...
javascript
function updateExpression(value) { // Rather than passing undefined to the jqLite toggle class function we explicitly set the // value to true. Otherwise the class will be just toggled instead of being forced. if (angular.isUndefined(value)) { value = true; } element.toggleClass(...
[ "function", "updateExpression", "(", "value", ")", "{", "// Rather than passing undefined to the jqLite toggle class function we explicitly set the", "// value to true. Otherwise the class will be just toggled instead of being forced.", "if", "(", "angular", ".", "isUndefined", "(", "val...
Updates the autofocus class which is used to determine whether the attribute expression evaluates to true or false. @param {string|boolean} value Attribute Value
[ "Updates", "the", "autofocus", "class", "which", "is", "used", "to", "determine", "whether", "the", "attribute", "expression", "evaluates", "to", "true", "or", "false", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/util/autofocus.js#L117-L126
train
angular/material
config/ngModuleData.js
buildScanner
function buildScanner(pattern) { return function findPatternIn(content) { let dependencies; const match = pattern.exec(content || ''); const moduleName = match ? match[1].replace(/'/gi,'') : null; const depsMatch = match && match[2] && match[2].trim(); if (depsMatch) { dependencies = depsM...
javascript
function buildScanner(pattern) { return function findPatternIn(content) { let dependencies; const match = pattern.exec(content || ''); const moduleName = match ? match[1].replace(/'/gi,'') : null; const depsMatch = match && match[2] && match[2].trim(); if (depsMatch) { dependencies = depsM...
[ "function", "buildScanner", "(", "pattern", ")", "{", "return", "function", "findPatternIn", "(", "content", ")", "{", "let", "dependencies", ";", "const", "match", "=", "pattern", ".", "exec", "(", "content", "||", "''", ")", ";", "const", "moduleName", "...
Find module definition s that match the module definition pattern
[ "Find", "module", "definition", "s", "that", "match", "the", "module", "definition", "pattern" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/config/ngModuleData.js#L21-L42
train
angular/material
src/components/progressCircular/js/progressCircularDirective.js
getDashLength
function getDashLength(diameter, strokeWidth, value, limit) { return (diameter - strokeWidth) * $window.Math.PI * ((3 * (limit || 100) / 100) - (value/100)); }
javascript
function getDashLength(diameter, strokeWidth, value, limit) { return (diameter - strokeWidth) * $window.Math.PI * ((3 * (limit || 100) / 100) - (value/100)); }
[ "function", "getDashLength", "(", "diameter", ",", "strokeWidth", ",", "value", ",", "limit", ")", "{", "return", "(", "diameter", "-", "strokeWidth", ")", "*", "$window", ".", "Math", ".", "PI", "*", "(", "(", "3", "*", "(", "limit", "||", "100", ")...
Return stroke length for progress circle @param {number} diameter Diameter of the container. @param {number} strokeWidth Stroke width to be used when drawing circle @param {number} value Percentage of circle (between 0 and 100) @param {number} limit Max percentage for circle @returns {number} Stroke length for progre...
[ "Return", "stroke", "length", "for", "progress", "circle" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/progressCircular/js/progressCircularDirective.js#L337-L339
train
angular/material
src/components/tooltip/tooltip.js
MdTooltipRegistry
function MdTooltipRegistry() { var listeners = {}; var ngWindow = angular.element(window); return { register: register, deregister: deregister }; /** * Global event handler that dispatches the registered handlers in the * service. * @param {!Event} event Event object passed in by the browse...
javascript
function MdTooltipRegistry() { var listeners = {}; var ngWindow = angular.element(window); return { register: register, deregister: deregister }; /** * Global event handler that dispatches the registered handlers in the * service. * @param {!Event} event Event object passed in by the browse...
[ "function", "MdTooltipRegistry", "(", ")", "{", "var", "listeners", "=", "{", "}", ";", "var", "ngWindow", "=", "angular", ".", "element", "(", "window", ")", ";", "return", "{", "register", ":", "register", ",", "deregister", ":", "deregister", "}", ";"...
Service that is used to reduce the amount of listeners that are being registered on the `window` by the tooltip component. Works by collecting the individual event handlers and dispatching them from a global handler. @ngInject
[ "Service", "that", "is", "used", "to", "reduce", "the", "amount", "of", "listeners", "that", "are", "being", "registered", "on", "the", "window", "by", "the", "tooltip", "component", ".", "Works", "by", "collecting", "the", "individual", "event", "handlers", ...
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tooltip/tooltip.js#L423-L483
train
angular/material
src/components/tooltip/tooltip.js
globalEventHandler
function globalEventHandler(event) { if (listeners[event.type]) { listeners[event.type].forEach(function(currentHandler) { currentHandler.call(this, event); }, this); } }
javascript
function globalEventHandler(event) { if (listeners[event.type]) { listeners[event.type].forEach(function(currentHandler) { currentHandler.call(this, event); }, this); } }
[ "function", "globalEventHandler", "(", "event", ")", "{", "if", "(", "listeners", "[", "event", ".", "type", "]", ")", "{", "listeners", "[", "event", ".", "type", "]", ".", "forEach", "(", "function", "(", "currentHandler", ")", "{", "currentHandler", "...
Global event handler that dispatches the registered handlers in the service. @param {!Event} event Event object passed in by the browser
[ "Global", "event", "handler", "that", "dispatches", "the", "registered", "handlers", "in", "the", "service", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tooltip/tooltip.js#L437-L443
train
angular/material
src/components/tooltip/tooltip.js
register
function register(type, handler, useCapture) { var handlers = listeners[type] = listeners[type] || []; if (!handlers.length) { useCapture ? window.addEventListener(type, globalEventHandler, true) : ngWindow.on(type, globalEventHandler); } if (handlers.indexOf(handler) === -1) { h...
javascript
function register(type, handler, useCapture) { var handlers = listeners[type] = listeners[type] || []; if (!handlers.length) { useCapture ? window.addEventListener(type, globalEventHandler, true) : ngWindow.on(type, globalEventHandler); } if (handlers.indexOf(handler) === -1) { h...
[ "function", "register", "(", "type", ",", "handler", ",", "useCapture", ")", "{", "var", "handlers", "=", "listeners", "[", "type", "]", "=", "listeners", "[", "type", "]", "||", "[", "]", ";", "if", "(", "!", "handlers", ".", "length", ")", "{", "...
Registers a new handler with the service. @param {string} type Type of event to be registered. @param {!Function} handler Event handler. @param {boolean} useCapture Whether to use event capturing.
[ "Registers", "a", "new", "handler", "with", "the", "service", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tooltip/tooltip.js#L451-L462
train
angular/material
src/components/tooltip/tooltip.js
deregister
function deregister(type, handler, useCapture) { var handlers = listeners[type]; var index = handlers ? handlers.indexOf(handler) : -1; if (index > -1) { handlers.splice(index, 1); if (handlers.length === 0) { useCapture ? window.removeEventListener(type, globalEventHandler, true) : ...
javascript
function deregister(type, handler, useCapture) { var handlers = listeners[type]; var index = handlers ? handlers.indexOf(handler) : -1; if (index > -1) { handlers.splice(index, 1); if (handlers.length === 0) { useCapture ? window.removeEventListener(type, globalEventHandler, true) : ...
[ "function", "deregister", "(", "type", ",", "handler", ",", "useCapture", ")", "{", "var", "handlers", "=", "listeners", "[", "type", "]", ";", "var", "index", "=", "handlers", "?", "handlers", ".", "indexOf", "(", "handler", ")", ":", "-", "1", ";", ...
Removes an event handler from the service. @param {string} type Type of event handler. @param {!Function} handler The event handler itself. @param {boolean} useCapture Whether the event handler used event capturing.
[ "Removes", "an", "event", "handler", "from", "the", "service", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tooltip/tooltip.js#L470-L482
train
angular/material
src/components/datepicker/js/calendar.spec.js
findCellByLabel
function findCellByLabel(monthElement, day) { var tds = monthElement.querySelectorAll('td'); var td; for (var i = 0; i < tds.length; i++) { td = tds[i]; if (td.textContent === day.toString()) { return td; } } }
javascript
function findCellByLabel(monthElement, day) { var tds = monthElement.querySelectorAll('td'); var td; for (var i = 0; i < tds.length; i++) { td = tds[i]; if (td.textContent === day.toString()) { return td; } } }
[ "function", "findCellByLabel", "(", "monthElement", ",", "day", ")", "{", "var", "tds", "=", "monthElement", ".", "querySelectorAll", "(", "'td'", ")", ";", "var", "td", ";", "for", "(", "var", "i", "=", "0", ";", "i", "<", "tds", ".", "length", ";",...
Finds a td given a label.
[ "Finds", "a", "td", "given", "a", "label", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L44-L54
train
angular/material
src/components/datepicker/js/calendar.spec.js
findMonthElement
function findMonthElement(element, date) { var months = element.querySelectorAll('[md-calendar-month-body]'); var monthHeader = dateLocale.monthHeaderFormatter(date); var month; for (var i = 0; i < months.length; i++) { month = months[i]; if (month.querySelector('tr:first-child td:first-chi...
javascript
function findMonthElement(element, date) { var months = element.querySelectorAll('[md-calendar-month-body]'); var monthHeader = dateLocale.monthHeaderFormatter(date); var month; for (var i = 0; i < months.length; i++) { month = months[i]; if (month.querySelector('tr:first-child td:first-chi...
[ "function", "findMonthElement", "(", "element", ",", "date", ")", "{", "var", "months", "=", "element", ".", "querySelectorAll", "(", "'[md-calendar-month-body]'", ")", ";", "var", "monthHeader", "=", "dateLocale", ".", "monthHeaderFormatter", "(", "date", ")", ...
Finds a month `tbody` in the calendar element given a date.
[ "Finds", "a", "month", "tbody", "in", "the", "calendar", "element", "given", "a", "date", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L59-L71
train
angular/material
src/components/datepicker/js/calendar.spec.js
findYearElement
function findYearElement(parent, year) { var node = parent[0] || parent; var years = node.querySelectorAll('[md-calendar-year-body]'); var yearHeader = year.toString(); var target; for (var i = 0; i < years.length; i++) { target = years[i]; if (target.querySelector('.md-calendar-month-l...
javascript
function findYearElement(parent, year) { var node = parent[0] || parent; var years = node.querySelectorAll('[md-calendar-year-body]'); var yearHeader = year.toString(); var target; for (var i = 0; i < years.length; i++) { target = years[i]; if (target.querySelector('.md-calendar-month-l...
[ "function", "findYearElement", "(", "parent", ",", "year", ")", "{", "var", "node", "=", "parent", "[", "0", "]", "||", "parent", ";", "var", "years", "=", "node", ".", "querySelectorAll", "(", "'[md-calendar-year-body]'", ")", ";", "var", "yearHeader", "=...
Find the `tbody` for a year in the calendar.
[ "Find", "the", "tbody", "for", "a", "year", "in", "the", "calendar", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L74-L87
train
angular/material
src/components/datepicker/js/calendar.spec.js
createElement
function createElement(parentScope, templateOverride) { var directiveScope = parentScope || $rootScope.$new(); var template = templateOverride || '<md-calendar md-min-date="minDate" md-max-date="maxDate" ' + 'ng-model="myDate"></md-calendar>'; var attachedElement = angular.element(template); doc...
javascript
function createElement(parentScope, templateOverride) { var directiveScope = parentScope || $rootScope.$new(); var template = templateOverride || '<md-calendar md-min-date="minDate" md-max-date="maxDate" ' + 'ng-model="myDate"></md-calendar>'; var attachedElement = angular.element(template); doc...
[ "function", "createElement", "(", "parentScope", ",", "templateOverride", ")", "{", "var", "directiveScope", "=", "parentScope", "||", "$rootScope", ".", "$new", "(", ")", ";", "var", "template", "=", "templateOverride", "||", "'<md-calendar md-min-date=\"minDate\" md...
Creates and compiles an md-calendar element.
[ "Creates", "and", "compiles", "an", "md", "-", "calendar", "element", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L99-L109
train
angular/material
src/components/datepicker/js/calendar.spec.js
dispatchKeyEvent
function dispatchKeyEvent(keyCode, opt_modifiers) { var mod = opt_modifiers || {}; angular.element(element).triggerHandler({ type: 'keydown', keyCode: keyCode, which: keyCode, ctrlKey: mod.ctrl, altKey: mod.alt, metaKey: mod.meta, shortKey: mod.shift }); }
javascript
function dispatchKeyEvent(keyCode, opt_modifiers) { var mod = opt_modifiers || {}; angular.element(element).triggerHandler({ type: 'keydown', keyCode: keyCode, which: keyCode, ctrlKey: mod.ctrl, altKey: mod.alt, metaKey: mod.meta, shortKey: mod.shift }); }
[ "function", "dispatchKeyEvent", "(", "keyCode", ",", "opt_modifiers", ")", "{", "var", "mod", "=", "opt_modifiers", "||", "{", "}", ";", "angular", ".", "element", "(", "element", ")", ".", "triggerHandler", "(", "{", "type", ":", "'keydown'", ",", "keyCod...
Dispatches a KeyboardEvent for the calendar. @param {number} keyCode @param {Object=} opt_modifiers
[ "Dispatches", "a", "KeyboardEvent", "for", "the", "calendar", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/datepicker/js/calendar.spec.js#L116-L129
train
angular/material
src/components/tabs/tabsPaginationService.js
decreasePageOffset
function decreasePageOffset(elements, currentOffset) { var canvas = elements.canvas, tabOffsets = getTabOffsets(elements), i, firstVisibleTabOffset; // Find the first fully visible tab in offset range for (i = 0; i < tabOffsets.length; i++) { if (tabOffsets[i] >= currentOffset...
javascript
function decreasePageOffset(elements, currentOffset) { var canvas = elements.canvas, tabOffsets = getTabOffsets(elements), i, firstVisibleTabOffset; // Find the first fully visible tab in offset range for (i = 0; i < tabOffsets.length; i++) { if (tabOffsets[i] >= currentOffset...
[ "function", "decreasePageOffset", "(", "elements", ",", "currentOffset", ")", "{", "var", "canvas", "=", "elements", ".", "canvas", ",", "tabOffsets", "=", "getTabOffsets", "(", "elements", ")", ",", "i", ",", "firstVisibleTabOffset", ";", "// Find the first fully...
Returns the offset for the next decreasing page. @param elements @param currentOffset @returns {number}
[ "Returns", "the", "offset", "for", "the", "next", "decreasing", "page", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/tabsPaginationService.js#L38-L53
train
angular/material
src/components/tabs/tabsPaginationService.js
increasePageOffset
function increasePageOffset(elements, currentOffset) { var canvas = elements.canvas, maxOffset = getTotalTabsWidth(elements) - canvas.clientWidth, tabOffsets = getTabOffsets(elements), i, firstHiddenTabOffset; // Find the first partially (or fully) invisible tab for (i = ...
javascript
function increasePageOffset(elements, currentOffset) { var canvas = elements.canvas, maxOffset = getTotalTabsWidth(elements) - canvas.clientWidth, tabOffsets = getTabOffsets(elements), i, firstHiddenTabOffset; // Find the first partially (or fully) invisible tab for (i = ...
[ "function", "increasePageOffset", "(", "elements", ",", "currentOffset", ")", "{", "var", "canvas", "=", "elements", ".", "canvas", ",", "maxOffset", "=", "getTotalTabsWidth", "(", "elements", ")", "-", "canvas", ".", "clientWidth", ",", "tabOffsets", "=", "ge...
Returns the offset for the next increasing page. @param elements @param currentOffset @returns {number}
[ "Returns", "the", "offset", "for", "the", "next", "increasing", "page", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/tabsPaginationService.js#L62-L75
train
angular/material
src/components/tabs/tabsPaginationService.js
getTabOffsets
function getTabOffsets(elements) { var i, tab, currentOffset = 0, offsets = []; for (i = 0; i < elements.tabs.length; i++) { tab = elements.tabs[i]; offsets.push(currentOffset); currentOffset += tab.offsetWidth; } return offsets; }
javascript
function getTabOffsets(elements) { var i, tab, currentOffset = 0, offsets = []; for (i = 0; i < elements.tabs.length; i++) { tab = elements.tabs[i]; offsets.push(currentOffset); currentOffset += tab.offsetWidth; } return offsets; }
[ "function", "getTabOffsets", "(", "elements", ")", "{", "var", "i", ",", "tab", ",", "currentOffset", "=", "0", ",", "offsets", "=", "[", "]", ";", "for", "(", "i", "=", "0", ";", "i", "<", "elements", ".", "tabs", ".", "length", ";", "i", "++", ...
Returns the offsets of all of the tabs based on their widths. @param elements @returns {number[]}
[ "Returns", "the", "offsets", "of", "all", "of", "the", "tabs", "based", "on", "their", "widths", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/tabsPaginationService.js#L83-L93
train
angular/material
src/components/tabs/tabsPaginationService.js
getTotalTabsWidth
function getTotalTabsWidth(elements) { var sum = 0, i, tab; for (i = 0; i < elements.tabs.length; i++) { tab = elements.tabs[i]; sum += tab.offsetWidth; } return sum; }
javascript
function getTotalTabsWidth(elements) { var sum = 0, i, tab; for (i = 0; i < elements.tabs.length; i++) { tab = elements.tabs[i]; sum += tab.offsetWidth; } return sum; }
[ "function", "getTotalTabsWidth", "(", "elements", ")", "{", "var", "sum", "=", "0", ",", "i", ",", "tab", ";", "for", "(", "i", "=", "0", ";", "i", "<", "elements", ".", "tabs", ".", "length", ";", "i", "++", ")", "{", "tab", "=", "elements", "...
Sum the width of all tabs. @param elements @returns {number}
[ "Sum", "the", "width", "of", "all", "tabs", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/tabs/tabsPaginationService.js#L101-L110
train
angular/material
src/core/services/theming/theming.js
function() { return angular.extend({ }, themeConfig, { defaultTheme : defaultTheme, alwaysWatchTheme : alwaysWatchTheme, registeredStyles : [].concat(themeConfig.registeredStyles) }); }
javascript
function() { return angular.extend({ }, themeConfig, { defaultTheme : defaultTheme, alwaysWatchTheme : alwaysWatchTheme, registeredStyles : [].concat(themeConfig.registeredStyles) }); }
[ "function", "(", ")", "{", "return", "angular", ".", "extend", "(", "{", "}", ",", "themeConfig", ",", "{", "defaultTheme", ":", "defaultTheme", ",", "alwaysWatchTheme", ":", "alwaysWatchTheme", ",", "registeredStyles", ":", "[", "]", ".", "concat", "(", "...
return a read-only clone of the current theme configuration
[ "return", "a", "read", "-", "only", "clone", "of", "the", "current", "theme", "configuration" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L297-L303
train
angular/material
src/core/services/theming/theming.js
checkPaletteValid
function checkPaletteValid(name, map) { var missingColors = VALID_HUE_VALUES.filter(function(field) { return !map[field]; }); if (missingColors.length) { throw new Error("Missing colors %1 in palette %2!" .replace('%1', missingColors.join(', ')) .repla...
javascript
function checkPaletteValid(name, map) { var missingColors = VALID_HUE_VALUES.filter(function(field) { return !map[field]; }); if (missingColors.length) { throw new Error("Missing colors %1 in palette %2!" .replace('%1', missingColors.join(', ')) .repla...
[ "function", "checkPaletteValid", "(", "name", ",", "map", ")", "{", "var", "missingColors", "=", "VALID_HUE_VALUES", ".", "filter", "(", "function", "(", "field", ")", "{", "return", "!", "map", "[", "field", "]", ";", "}", ")", ";", "if", "(", "missin...
Make sure that palette has all required hues
[ "Make", "sure", "that", "palette", "has", "all", "required", "hues" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L441-L452
train
angular/material
src/core/services/theming/theming.js
function (scope, el) { if (el === undefined) { el = scope; scope = undefined; } if (scope === undefined) { scope = $rootScope; } applyTheme.inherit(el, el); }
javascript
function (scope, el) { if (el === undefined) { el = scope; scope = undefined; } if (scope === undefined) { scope = $rootScope; } applyTheme.inherit(el, el); }
[ "function", "(", "scope", ",", "el", ")", "{", "if", "(", "el", "===", "undefined", ")", "{", "el", "=", "scope", ";", "scope", "=", "undefined", ";", "}", "if", "(", "scope", "===", "undefined", ")", "{", "scope", "=", "$rootScope", ";", "}", "a...
Allow us to be invoked via a linking function signature.
[ "Allow", "us", "to", "be", "invoked", "via", "a", "linking", "function", "signature", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L711-L715
train
angular/material
src/core/services/theming/theming.js
registered
function registered(themeName) { if (themeName === undefined || themeName === '') return true; return applyTheme.THEMES[themeName] !== undefined; }
javascript
function registered(themeName) { if (themeName === undefined || themeName === '') return true; return applyTheme.THEMES[themeName] !== undefined; }
[ "function", "registered", "(", "themeName", ")", "{", "if", "(", "themeName", "===", "undefined", "||", "themeName", "===", "''", ")", "return", "true", ";", "return", "applyTheme", ".", "THEMES", "[", "themeName", "]", "!==", "undefined", ";", "}" ]
Determine is specified theme name is a valid, registered theme
[ "Determine", "is", "specified", "theme", "name", "is", "a", "valid", "registered", "theme" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L768-L771
train
angular/material
src/core/services/theming/theming.js
inheritTheme
function inheritTheme (el, parent) { var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController'); var scope = el.scope(); updateThemeClass(lookupThemeName()); if (ctrl) { var watchTheme = alwaysWatchTheme || ctrl.$shouldWatch || ...
javascript
function inheritTheme (el, parent) { var ctrl = parent.controller('mdTheme') || el.data('$mdThemeController'); var scope = el.scope(); updateThemeClass(lookupThemeName()); if (ctrl) { var watchTheme = alwaysWatchTheme || ctrl.$shouldWatch || ...
[ "function", "inheritTheme", "(", "el", ",", "parent", ")", "{", "var", "ctrl", "=", "parent", ".", "controller", "(", "'mdTheme'", ")", "||", "el", ".", "data", "(", "'$mdThemeController'", ")", ";", "var", "scope", "=", "el", ".", "scope", "(", ")", ...
Get theme name for the element, then update with Theme CSS class
[ "Get", "theme", "name", "for", "the", "element", "then", "update", "with", "Theme", "CSS", "class" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/core/services/theming/theming.js#L776-L838
train
angular/material
src/components/autocomplete/js/autocompleteController.js
init
function init () { $mdUtil.initOptionalProperties($scope, $attrs, { searchText: '', selectedItem: null, clearButton: false, disableVirtualRepeat: false, }); $mdTheming($element); configureWatchers(); $mdUtil.nextTick(function () { gatherElements(); moveDropdown...
javascript
function init () { $mdUtil.initOptionalProperties($scope, $attrs, { searchText: '', selectedItem: null, clearButton: false, disableVirtualRepeat: false, }); $mdTheming($element); configureWatchers(); $mdUtil.nextTick(function () { gatherElements(); moveDropdown...
[ "function", "init", "(", ")", "{", "$mdUtil", ".", "initOptionalProperties", "(", "$scope", ",", "$attrs", ",", "{", "searchText", ":", "''", ",", "selectedItem", ":", "null", ",", "clearButton", ":", "false", ",", "disableVirtualRepeat", ":", "false", ",", ...
initialization methods Initialize the controller, setup watchers, gather elements
[ "initialization", "methods", "Initialize", "the", "controller", "setup", "watchers", "gather", "elements" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L80-L115
train
angular/material
src/components/autocomplete/js/autocompleteController.js
getVerticalOffset
function getVerticalOffset () { var offset = 0; var inputContainer = $element.find('md-input-container'); if (inputContainer.length) { var input = inputContainer.find('input'); offset = inputContainer.prop('offsetHeight'); offset -= input.prop('offsetTop'); offset -= in...
javascript
function getVerticalOffset () { var offset = 0; var inputContainer = $element.find('md-input-container'); if (inputContainer.length) { var input = inputContainer.find('input'); offset = inputContainer.prop('offsetHeight'); offset -= input.prop('offsetTop'); offset -= in...
[ "function", "getVerticalOffset", "(", ")", "{", "var", "offset", "=", "0", ";", "var", "inputContainer", "=", "$element", ".", "find", "(", "'md-input-container'", ")", ";", "if", "(", "inputContainer", ".", "length", ")", "{", "var", "input", "=", "inputC...
Calculates the vertical offset for floating label examples to account for ngMessages @returns {number}
[ "Calculates", "the", "vertical", "offset", "for", "floating", "label", "examples", "to", "account", "for", "ngMessages" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L188-L200
train
angular/material
src/components/autocomplete/js/autocompleteController.js
moveDropdown
function moveDropdown () { if (!elements.$.root.length) return; $mdTheming(elements.$.scrollContainer); elements.$.scrollContainer.detach(); elements.$.root.append(elements.$.scrollContainer); if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement); }
javascript
function moveDropdown () { if (!elements.$.root.length) return; $mdTheming(elements.$.scrollContainer); elements.$.scrollContainer.detach(); elements.$.root.append(elements.$.scrollContainer); if ($animate.pin) $animate.pin(elements.$.scrollContainer, $rootElement); }
[ "function", "moveDropdown", "(", ")", "{", "if", "(", "!", "elements", ".", "$", ".", "root", ".", "length", ")", "return", ";", "$mdTheming", "(", "elements", ".", "$", ".", "scrollContainer", ")", ";", "elements", ".", "$", ".", "scrollContainer", "....
Moves the dropdown menu to the body tag in order to avoid z-index and overflow issues.
[ "Moves", "the", "dropdown", "menu", "to", "the", "body", "tag", "in", "order", "to", "avoid", "z", "-", "index", "and", "overflow", "issues", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L218-L224
train
angular/material
src/components/autocomplete/js/autocompleteController.js
cleanup
function cleanup () { if (!ctrl.hidden) { $mdUtil.enableScrolling(); } angular.element($window).off('resize', debouncedOnResize); if (elements){ var items = ['ul', 'scroller', 'scrollContainer', 'input']; angular.forEach(items, function(key){ elements.$[key].remove(); }...
javascript
function cleanup () { if (!ctrl.hidden) { $mdUtil.enableScrolling(); } angular.element($window).off('resize', debouncedOnResize); if (elements){ var items = ['ul', 'scroller', 'scrollContainer', 'input']; angular.forEach(items, function(key){ elements.$[key].remove(); }...
[ "function", "cleanup", "(", ")", "{", "if", "(", "!", "ctrl", ".", "hidden", ")", "{", "$mdUtil", ".", "enableScrolling", "(", ")", ";", "}", "angular", ".", "element", "(", "$window", ")", ".", "off", "(", "'resize'", ",", "debouncedOnResize", ")", ...
Removes any events or leftover elements created by this controller
[ "Removes", "any", "events", "or", "leftover", "elements", "created", "by", "this", "controller" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L254-L267
train
angular/material
src/components/autocomplete/js/autocompleteController.js
gatherSnapWrap
function gatherSnapWrap() { var element; var value; for (element = $element; element.length; element = element.parent()) { value = element.attr('md-autocomplete-snap'); if (angular.isDefined(value)) break; } if (element.length) { return { snap: element[0], wrap: (v...
javascript
function gatherSnapWrap() { var element; var value; for (element = $element; element.length; element = element.parent()) { value = element.attr('md-autocomplete-snap'); if (angular.isDefined(value)) break; } if (element.length) { return { snap: element[0], wrap: (v...
[ "function", "gatherSnapWrap", "(", ")", "{", "var", "element", ";", "var", "value", ";", "for", "(", "element", "=", "$element", ";", "element", ".", "length", ";", "element", "=", "element", ".", "parent", "(", ")", ")", "{", "value", "=", "element", ...
Gathers the snap and wrap elements
[ "Gathers", "the", "snap", "and", "wrap", "elements" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L306-L326
train
angular/material
src/components/autocomplete/js/autocompleteController.js
getAngularElements
function getAngularElements (elements) { var obj = {}; for (var key in elements) { if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]); } return obj; }
javascript
function getAngularElements (elements) { var obj = {}; for (var key in elements) { if (elements.hasOwnProperty(key)) obj[ key ] = angular.element(elements[ key ]); } return obj; }
[ "function", "getAngularElements", "(", "elements", ")", "{", "var", "obj", "=", "{", "}", ";", "for", "(", "var", "key", "in", "elements", ")", "{", "if", "(", "elements", ".", "hasOwnProperty", "(", "key", ")", ")", "obj", "[", "key", "]", "=", "a...
Gathers angular-wrapped versions of each element @param elements @returns {{}}
[ "Gathers", "angular", "-", "wrapped", "versions", "of", "each", "element" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L333-L339
train
angular/material
src/components/autocomplete/js/autocompleteController.js
disableElementScrollEvents
function disableElementScrollEvents(element) { function preventDefault(e) { e.preventDefault(); } element.on('wheel', preventDefault); element.on('touchmove', preventDefault); return function() { element.off('wheel', preventDefault); element.off('touchmove', preventDefault); ...
javascript
function disableElementScrollEvents(element) { function preventDefault(e) { e.preventDefault(); } element.on('wheel', preventDefault); element.on('touchmove', preventDefault); return function() { element.off('wheel', preventDefault); element.off('touchmove', preventDefault); ...
[ "function", "disableElementScrollEvents", "(", "element", ")", "{", "function", "preventDefault", "(", "e", ")", "{", "e", ".", "preventDefault", "(", ")", ";", "}", "element", ".", "on", "(", "'wheel'", ",", "preventDefault", ")", ";", "element", ".", "on...
Disables scrolling for a specific element
[ "Disables", "scrolling", "for", "a", "specific", "element" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L373-L386
train
angular/material
src/components/autocomplete/js/autocompleteController.js
onListLeave
function onListLeave () { if (!hasFocus && !ctrl.hidden) elements.input.focus(); noBlur = false; ctrl.hidden = shouldHide(); }
javascript
function onListLeave () { if (!hasFocus && !ctrl.hidden) elements.input.focus(); noBlur = false; ctrl.hidden = shouldHide(); }
[ "function", "onListLeave", "(", ")", "{", "if", "(", "!", "hasFocus", "&&", "!", "ctrl", ".", "hidden", ")", "elements", ".", "input", ".", "focus", "(", ")", ";", "noBlur", "=", "false", ";", "ctrl", ".", "hidden", "=", "shouldHide", "(", ")", ";"...
When the user's mouse leaves the menu, blur events may hide the menu again.
[ "When", "the", "user", "s", "mouse", "leaves", "the", "menu", "blur", "events", "may", "hide", "the", "menu", "again", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L398-L402
train
angular/material
src/components/autocomplete/js/autocompleteController.js
unregisterSelectedItemWatcher
function unregisterSelectedItemWatcher (cb) { var i = selectedItemWatchers.indexOf(cb); if (i !== -1) { selectedItemWatchers.splice(i, 1); } }
javascript
function unregisterSelectedItemWatcher (cb) { var i = selectedItemWatchers.indexOf(cb); if (i !== -1) { selectedItemWatchers.splice(i, 1); } }
[ "function", "unregisterSelectedItemWatcher", "(", "cb", ")", "{", "var", "i", "=", "selectedItemWatchers", ".", "indexOf", "(", "cb", ")", ";", "if", "(", "i", "!==", "-", "1", ")", "{", "selectedItemWatchers", ".", "splice", "(", "i", ",", "1", ")", "...
Unregister a function previously registered for selected item changes. @param cb
[ "Unregister", "a", "function", "previously", "registered", "for", "selected", "item", "changes", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L483-L488
train
angular/material
src/components/autocomplete/js/autocompleteController.js
doBlur
function doBlur(forceBlur) { if (forceBlur) { noBlur = false; hasFocus = false; } elements.input.blur(); }
javascript
function doBlur(forceBlur) { if (forceBlur) { noBlur = false; hasFocus = false; } elements.input.blur(); }
[ "function", "doBlur", "(", "forceBlur", ")", "{", "if", "(", "forceBlur", ")", "{", "noBlur", "=", "false", ";", "hasFocus", "=", "false", ";", "}", "elements", ".", "input", ".", "blur", "(", ")", ";", "}" ]
Force blur on input element @param forceBlur
[ "Force", "blur", "on", "input", "element" ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L544-L550
train
angular/material
src/components/autocomplete/js/autocompleteController.js
focus
function focus($event) { hasFocus = true; if (isSearchable() && isMinLengthMet()) { handleQuery(); } ctrl.hidden = shouldHide(); evalAttr('ngFocus', { $event: $event }); }
javascript
function focus($event) { hasFocus = true; if (isSearchable() && isMinLengthMet()) { handleQuery(); } ctrl.hidden = shouldHide(); evalAttr('ngFocus', { $event: $event }); }
[ "function", "focus", "(", "$event", ")", "{", "hasFocus", "=", "true", ";", "if", "(", "isSearchable", "(", ")", "&&", "isMinLengthMet", "(", ")", ")", "{", "handleQuery", "(", ")", ";", "}", "ctrl", ".", "hidden", "=", "shouldHide", "(", ")", ";", ...
Handles input focus event, determines if the dropdown should show.
[ "Handles", "input", "focus", "event", "determines", "if", "the", "dropdown", "should", "show", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L555-L565
train
angular/material
src/components/autocomplete/js/autocompleteController.js
getItemAsNameVal
function getItemAsNameVal (item) { if (!item) { return undefined; } var locals = {}; if (ctrl.itemName) { locals[ ctrl.itemName ] = item; } return locals; }
javascript
function getItemAsNameVal (item) { if (!item) { return undefined; } var locals = {}; if (ctrl.itemName) { locals[ ctrl.itemName ] = item; } return locals; }
[ "function", "getItemAsNameVal", "(", "item", ")", "{", "if", "(", "!", "item", ")", "{", "return", "undefined", ";", "}", "var", "locals", "=", "{", "}", ";", "if", "(", "ctrl", ".", "itemName", ")", "{", "locals", "[", "ctrl", ".", "itemName", "]"...
Returns the locals object for compiling item templates. @param item @returns {Object|undefined}
[ "Returns", "the", "locals", "object", "for", "compiling", "item", "templates", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L667-L678
train
angular/material
src/components/autocomplete/js/autocompleteController.js
isSearchable
function isSearchable() { if (ctrl.loading && !hasMatches()) { // No query when query is in progress. return false; } else if (hasSelection()) { // No query if there is already a selection return false; } else if (!hasFocus) { // No query if the input does not have focus ...
javascript
function isSearchable() { if (ctrl.loading && !hasMatches()) { // No query when query is in progress. return false; } else if (hasSelection()) { // No query if there is already a selection return false; } else if (!hasFocus) { // No query if the input does not have focus ...
[ "function", "isSearchable", "(", ")", "{", "if", "(", "ctrl", ".", "loading", "&&", "!", "hasMatches", "(", ")", ")", "{", "// No query when query is in progress.", "return", "false", ";", "}", "else", "if", "(", "hasSelection", "(", ")", ")", "{", "// No ...
Determines whether the autocomplete is able to query within the current state. @returns {boolean} true if the query can be run
[ "Determines", "whether", "the", "autocomplete", "is", "able", "to", "query", "within", "the", "current", "state", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L713-L726
train
angular/material
src/components/autocomplete/js/autocompleteController.js
select
function select (index) { // force form to update state for validation $mdUtil.nextTick(function () { getDisplayValue(ctrl.matches[ index ]).then(function (val) { var ngModel = elements.$.input.controller('ngModel'); $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive');...
javascript
function select (index) { // force form to update state for validation $mdUtil.nextTick(function () { getDisplayValue(ctrl.matches[ index ]).then(function (val) { var ngModel = elements.$.input.controller('ngModel'); $mdLiveAnnouncer.announce(val + ' ' + ctrl.selectedMessage, 'assertive');...
[ "function", "select", "(", "index", ")", "{", "// force form to update state for validation", "$mdUtil", ".", "nextTick", "(", "function", "(", ")", "{", "getDisplayValue", "(", "ctrl", ".", "matches", "[", "index", "]", ")", ".", "then", "(", "function", "(",...
Selects the item at the given index. @param {number} index to select
[ "Selects", "the", "item", "at", "the", "given", "index", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L819-L832
train
angular/material
src/components/autocomplete/js/autocompleteController.js
reportMessages
function reportMessages(isPolite, types) { var politeness = isPolite ? 'polite' : 'assertive'; var messages = []; if (types & ReportType.Selected && ctrl.index !== -1) { messages.push(getCurrentDisplayValue()); } if (types & ReportType.Count) { messages.push($q.resolve(getCountMessage(...
javascript
function reportMessages(isPolite, types) { var politeness = isPolite ? 'polite' : 'assertive'; var messages = []; if (types & ReportType.Selected && ctrl.index !== -1) { messages.push(getCurrentDisplayValue()); } if (types & ReportType.Count) { messages.push($q.resolve(getCountMessage(...
[ "function", "reportMessages", "(", "isPolite", ",", "types", ")", "{", "var", "politeness", "=", "isPolite", "?", "'polite'", ":", "'assertive'", ";", "var", "messages", "=", "[", "]", ";", "if", "(", "types", "&", "ReportType", ".", "Selected", "&&", "c...
Reports given message types to supported screen readers. @param {boolean} isPolite Whether the announcement should be polite. @param {!number} types Message flags to be reported to the screen reader.
[ "Reports", "given", "message", "types", "to", "supported", "screen", "readers", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L928-L943
train
angular/material
src/components/autocomplete/js/autocompleteController.js
handleQuery
function handleQuery () { var searchText = $scope.searchText || ''; var term = searchText.toLowerCase(); // If caching is enabled and the current searchText is stored in the cache if (!$scope.noCache && cache[term]) { // The results should be handled as same as a normal un-cached request does. ...
javascript
function handleQuery () { var searchText = $scope.searchText || ''; var term = searchText.toLowerCase(); // If caching is enabled and the current searchText is stored in the cache if (!$scope.noCache && cache[term]) { // The results should be handled as same as a normal un-cached request does. ...
[ "function", "handleQuery", "(", ")", "{", "var", "searchText", "=", "$scope", ".", "searchText", "||", "''", ";", "var", "term", "=", "searchText", ".", "toLowerCase", "(", ")", ";", "// If caching is enabled and the current searchText is stored in the cache", "if", ...
Starts the query to gather the results for the current searchText. Attempts to return cached results first, then forwards the process to `fetchResults` if necessary.
[ "Starts", "the", "query", "to", "gather", "the", "results", "for", "the", "current", "searchText", ".", "Attempts", "to", "return", "cached", "results", "first", "then", "forwards", "the", "process", "to", "fetchResults", "if", "necessary", "." ]
84ac558674e73958be84312444c48d9f823f6684
https://github.com/angular/material/blob/84ac558674e73958be84312444c48d9f823f6684/src/components/autocomplete/js/autocompleteController.js#L1023-L1036
train