Chapter 5: Managing $scope inheritance
HTML
<script src="https://code.angularjs.org/1.3.2/angular.js"></script>
<div ng-app="myApp">
<div ng-controller="Ctrl">
<myDirective></myDirective>
</div>
</div>
JavaScript
angular.module('myApp', [])
.controller('Ctrl', function($scope) {
$scope.names = ['Ben', 'Nate', 'Austin', 'Yiannis', 'Matt M', 'Matt B'];
$scope.addNew = function(){
$scope.names.push($scope.newName);
$scope.newName ='';
}
}).directive("myDirective", function(){
return {
template:"<div>myDirective</div>"
};
});