MCPcopy Create free account
hub / github.com/EricSimons/ionic-course / parseIsolateBindings

Function parseIsolateBindings

code/songhop/www/lib/angular/angular.js:6417–6441  ·  view source on GitHub ↗
(scope, directiveName)

Source from the content-addressed store, hash-verified

6415 var EVENT_HANDLER_ATTR_REGEXP = /^(on[a-z]+|formaction)$/;
6416
6417 function parseIsolateBindings(scope, directiveName) {
6418 var LOCAL_REGEXP = /^\s*([@&]|=(\*?))(\??)\s*(\w*)\s*$/;
6419
6420 var bindings = {};
6421
6422 forEach(scope, function(definition, scopeName) {
6423 var match = definition.match(LOCAL_REGEXP);
6424
6425 if (!match) {
6426 throw $compileMinErr('iscp',
6427 "Invalid isolate scope definition for directive '{0}'." +
6428 " Definition: {... {1}: '{2}' ...}",
6429 directiveName, scopeName, definition);
6430 }
6431
6432 bindings[scopeName] = {
6433 mode: match[1][0],
6434 collection: match[2] === '*',
6435 optional: match[3] === '?',
6436 attrName: match[4] || scopeName
6437 };
6438 });
6439
6440 return bindings;
6441 }
6442
6443 /**
6444 * @ngdoc method

Callers 1

$CompileProviderFunction · 0.70

Calls 1

forEachFunction · 0.70

Tested by

no test coverage detected