I have a simple example where I want to show the word "Peter" by directive templating. When a person makes a click on div - the name changes to "Juliet". However I am finding no error and nothing visible on screen.
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular.js/1.4.8/angular.min.js" ></script>
</head>
<body ng-app="myApp" ng-controller="myCtrl">
<people name="peter"></people>
<people name="peter"></people>
<script>
//app declaration
var app = angular.module('myApp', []);
//controller declaration
app.controller('myCtrl', function($scope) {
//code goes here ...
});
//directive declaration
app.directive('people', function() {
return {
restrict: 'E',
scope: {name:'='},
template: '<div ng-click="name = \'Juliet\'">{{name}}</div>',
}
});
</script>
</body>
</html>