MCPcopy Index your code
hub / github.com/angular-ui/ui-router / render

Function render

test/angular/1.3/angular.js:26100–26284  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

26098 }
26099
26100 function render() {
26101 renderScheduled = false;
26102
26103 // Temporary location for the option groups before we render them
26104 var optionGroups = {'':[]},
26105 optionGroupNames = [''],
26106 optionGroupName,
26107 optionGroup,
26108 option,
26109 existingParent, existingOptions, existingOption,
26110 viewValue = ctrl.$viewValue,
26111 values = valuesFn(scope) || [],
26112 keys = keyName ? sortedKeys(values) : values,
26113 key,
26114 value,
26115 groupLength, length,
26116 groupIndex, index,
26117 labelMap = {},
26118 selected,
26119 isSelected = createIsSelectedFn(viewValue),
26120 anySelected = false,
26121 lastElement,
26122 element,
26123 label,
26124 optionId;
26125
26126 trackKeysCache = {};
26127
26128 // We now build up the list of options we need (we merge later)
26129 for (index = 0; length = keys.length, index < length; index++) {
26130 key = index;
26131 if (keyName) {
26132 key = keys[index];
26133 if (key.charAt(0) === '$') continue;
26134 }
26135 value = values[key];
26136
26137 optionGroupName = callExpression(groupByFn, key, value) || '';
26138 if (!(optionGroup = optionGroups[optionGroupName])) {
26139 optionGroup = optionGroups[optionGroupName] = [];
26140 optionGroupNames.push(optionGroupName);
26141 }
26142
26143 selected = isSelected(key, value);
26144 anySelected = anySelected || selected;
26145
26146 label = callExpression(displayFn, key, value); // what will be seen by the user
26147
26148 // doing displayFn(scope, locals) || '' overwrites zero values
26149 label = isDefined(label) ? label : '';
26150 optionId = trackFn ? trackFn(scope, locals) : (keyName ? keys[index] : index);
26151 if (trackFn) {
26152 trackKeysCache[optionId] = key;
26153 }
26154
26155 optionGroup.push({
26156 // either the index into array or key from object
26157 id: optionId,

Callers 1

selectionChangedFunction · 0.70

Calls 6

createIsSelectedFnFunction · 0.85
callExpressionFunction · 0.85
updateLabelMapFunction · 0.85
sortedKeysFunction · 0.70
isDefinedFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected