Below is the code illustrating the isolated scope scenario.
directivesModule.controller('CustomersController', ['$scope', function ($scope) {
var counter = 0;
$scope.customer = {
name: 'David',
street: '1234 Anywhere St.'
};
}]);
directivesModule.directive('myIsolatedScopeWithName', function () {
return {
scope: {
name: '@',
},
template: 'Name: {{ name }}'
};
});
We can add below code in HTML to access the customer.name in isolated scope in directive
<div my-isolated-scope-with-name name="{{ customer.name }}"></div>
Now the question here is if we need multiple objects of controller to be accessed in isolated scope. Do we need to mention all of them in HTML or is there a way that we can access them directly in JS.?