ng isolated scope
by Himanshu Joshi
HTML
<div ng-app="docsIsolationExample" ng-controller="Controller">
<my-customer any-property="naomi"></my-customer>
</div>
JavaScript
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: '=anyProperty'
},
template: 'Name: {{customerInfo.name}} Address: {{customerInfo.address}}'
};
});