I'm struggling with getting my $scope.title
inside my directive, even though I've read that directives can inherit objects and variables from their parent scopes. I have a controller with a child directive, but for some reason it's not working.
Can anyone help me understand why?
Check out the code snippet here
var mod = angular.module('myApp', []);
mod.controller('myControl', controlFunc).directive('myDirec', direcFunc);
function controlFunc($scope){
$scope.title = "John Smith";
}
function direcFunc(){
return {
restrict: 'E',
template: '<h1>' + $scope.title + '</h1>'
};
}