AngularJS empty fiddle
AngularJS empty fiddle
by cmyworld
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.2.10/angular.js"></script>
<div ng-app="myApp">
<div ng-controller="Ctrl">
<div my-customer info="naomi">testValue: {{test}}</div>
</div>
</div>
JavaScript
var app = angular.module('myApp', []);
app.controller('Ctrl', function ($scope) {
$scope.naomi = {
name: 'Naomi',
address: '1600 Amphitheatre'
};
$scope.vojta = {
name: 'Vojta',
address: '3456 Somewhere Else'
};
})
.directive('myCustomer', function () {
return {
restrict: 'A',
scope: {
customerInfo: '=info'
},
link: function (scope, element, attrs) {
scope.test = 'sagar1';
}
};
});