MCPcopy
hub / github.com/angular-ui/ui-router / parseIsolateBindings

Function parseIsolateBindings

test/angular/1.7/angular.js:8651–8686  ·  view source on GitHub ↗
(scope, directiveName, isController)

Source from the content-addressed store, hash-verified

8649 var bindingCache = createMap();
8650
8651 function parseIsolateBindings(scope, directiveName, isController) {
8652 var LOCAL_REGEXP = /^([@&]|[=<](\*?))(\??)\s*([\w$]*)$/;
8653
8654 var bindings = createMap();
8655
8656 forEach(scope, function(definition, scopeName) {
8657 definition = definition.trim();
8658
8659 if (definition in bindingCache) {
8660 bindings[scopeName] = bindingCache[definition];
8661 return;
8662 }
8663 var match = definition.match(LOCAL_REGEXP);
8664
8665 if (!match) {
8666 throw $compileMinErr('iscp',
8667 'Invalid {3} for directive \'{0}\'.' +
8668 ' Definition: {... {1}: \'{2}\' ...}',
8669 directiveName, scopeName, definition,
8670 (isController ? 'controller bindings definition' :
8671 'isolate scope definition'));
8672 }
8673
8674 bindings[scopeName] = {
8675 mode: match[1][0],
8676 collection: match[2] === '*',
8677 optional: match[3] === '?',
8678 attrName: match[4] || scopeName
8679 };
8680 if (match[4]) {
8681 bindingCache[definition] = bindings[scopeName];
8682 }
8683 });
8684
8685 return bindings;
8686 }
8687
8688 function parseDirectiveBindings(directive, directiveName) {
8689 var bindings = {

Callers 1

parseDirectiveBindingsFunction · 0.70

Calls 3

matchMethod · 0.80
createMapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected