angular.module('example', []) .controller('exampleCtrl', function ($scope) { $scope.dynamicCondition = false; }) .directive('testCase', function () { return { restrict: 'A', scope: { 'condition': '=' }, link: function (scope, element, attrs) { //code here... }); } } });
<div ng-app="example" ng-controller="exampleCtrl"> <div test-case condition="dynamicCondition">Hello</div> </div>