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

Function parseIsolateBindings

test/angular/1.4/angular.js:7258–7291  ·  view source on GitHub ↗
(scope, directiveName, isController)

Source from the content-addressed store, hash-verified

7256 var bindingCache = createMap();
7257
7258 function parseIsolateBindings(scope, directiveName, isController) {
7259 var LOCAL_REGEXP = /^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/;
7260
7261 var bindings = createMap();
7262
7263 forEach(scope, function(definition, scopeName) {
7264 if (definition in bindingCache) {
7265 bindings[scopeName] = bindingCache[definition];
7266 return;
7267 }
7268 var match = definition.match(LOCAL_REGEXP);
7269
7270 if (!match) {
7271 throw $compileMinErr('iscp',
7272 "Invalid {3} for directive '{0}'." +
7273 " Definition: {... {1}: '{2}' ...}",
7274 directiveName, scopeName, definition,
7275 (isController ? "controller bindings definition" :
7276 "isolate scope definition"));
7277 }
7278
7279 bindings[scopeName] = {
7280 mode: match[1][0],
7281 collection: match[2] === '*',
7282 optional: match[3] === '?',
7283 attrName: match[4] || scopeName
7284 };
7285 if (match[4]) {
7286 bindingCache[definition] = bindings[scopeName];
7287 }
7288 });
7289
7290 return bindings;
7291 }
7292
7293 function parseDirectiveBindings(directive, directiveName) {
7294 var bindings = {

Callers 1

parseDirectiveBindingsFunction · 0.70

Calls 3

matchMethod · 0.80
createMapFunction · 0.70
forEachFunction · 0.70

Tested by

no test coverage detected