View code
<div ng-show="name">
<say-hello name="name"></say-hello>
</div>
Directive code
<script>
var helloDirectives = angular.module( "helloDirectives", [] );
helloDirectives.controller( "DirectivesCtrl", [ '$scope', function( $scope ){
$scope.name = "";
}]);
helloDirectives.directive( "sayHello", function() {
return {
restrict: 'EA',
scope: {
name: '='
},
template: '<h2>Hello, {{name}}</h2>'
};
});
</script>