I am reading the article on Directives and at the Isolated Scope section, I noticed
As the name suggests, the isolate scope of the directive isolates everything except models that you've explicitly added to the scope: {} hash object. This is helpful when building reusable components because it prevents a component from changing your model state except for the models that you explicitly pass in.
So I tried the example
Script.js
(function(angular) {
'use strict';
angular.module('docsIsolationExample', [])
.controller('Controller', ['$scope', function($scope) {
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.vojta = { name: 'Vojta', address: '3456 Somewhere Else' };
}])
.directive('myCustomer', function() {
return {
restrict: 'E',
scope: {
customerInfo: '=info'
},
templateUrl: 'my-customer-plus-vojta.html'
};
});
})(window.angular);
Actually what I am looking for is that if
$scope.naomi = { name: 'Naomi', address: '1600 Amphitheatre' };
$scope.vojta = { sex: 'Male', something: 'Something else' }
How can I print name,address (from naomi) and sex, something (from vojta)?