Yes by using element.isolateScope() for example (or see fiddle):
HTML
<div ng-app="app" ng-controller="BaseController as baseCtrl"> <input type="text" ng-model="inputA.value" directive-config="{data: 'bar'}" > <input type="text" ng-model="inputB.value" directive-config="{parsers: externalParser, data: 'buzz'}" custom-input > <br><br> <span style="font-style: italic; font-size: 12px; color: red;">*Open Console to view output</span> </div>
JS
(function(angular){ "use strict"; angular.module("app", []) .controller("BaseController", ['$scope', function($scope){ $scope.inputA = {value: "This is inputA"}; $scope.inputB = {value: "This is inputB"}; $scope.externalParser = function(value) { console.log("...parsing value: ", value); } }]) .directive("input", [function() { return { restrict: "E", require: '?ngModel', scope: { directiveConfig: "=" }, link: function(scope, element, attrs, ngModelCtrl) { console.log("input directive - scope: ", scope); console.log("input directive - scope.directiveConfig.data: ", scope.directiveConfig.data); } } }]) .directive("customInput", [function() { return { restrict: "A", require: '?ngModel', link: function(scope, element, attrs, ngModelCtrl) { console.log(""); console.log("--------------------------------------------"); console.log("customInput directive - scope: ", scope); // Use `element.isolateScope()` var parentScope = element.isolateScope(); console.log("customInput directive - parentScope.directiveConfig.parsers: ", parentScope.directiveConfig.parsers); console.log("customInput directive - parentScope.directiveConfig.data: ", parentScope.directiveConfig.data); console.log(""); console.log("--------------------------------------------"); console.warn("DO NOT USE `$$childHead` as it may not target the element you are expecting; use `element.isolateScope()` instead."); // DO NOT USE `$$childHead` as it may not be the element you expect console.log("customInput directive - scope.$$childHead.directiveConfig.parsers: ", scope.$$childHead.directiveConfig.parsers); console.log("customInput directive - scope.$$childHead.directiveConfig.data: ", scope.$$childHead.directiveConfig.data); } } }]) ; })(angular)
console output
//input directive - scope: n {$id: 3, $$childTail: null, $$childHead: null, $$prevSibling: null, $$nextSibling: null…} //input directive - scope.directiveConfig.data: bar //input directive - scope: n {$id: 4, $$childTail: null, $$childHead: null, $$prevSibling: n, $$nextSibling: null…} //input directive - scope.directiveConfig.data: buzz //-------------------------------------------- //customInput directive - scope: b {$$childTail: n, $$childHead: n, $$nextSibling: null, $$watchers: Array[4], $$listeners: Object…} //customInput directive - parentScope.directiveConfig.parsers: function (value) { // console.log("...parsing value: ", value); // } //customInput directive - parentScope.directiveConfig.data: buzz //-------------------------------------------- //DO NOT USE `$$childHead` as it may not target the element you are expecting; use `element.isolateScope()` instead. //customInput directive - scope.$$childHead.directiveConfig.parsers: undefined //customInput directive - scope.$$childHead.directiveConfig.data: bar
scope: { localProp: '=prop' }foraDirective?