<!DOCTYPE html>
<html ng-app="myApp">
<head>
<script data-require="jquery@1.10.2" data-semver="1.10.2" src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script data-require="angular.js@1.4.8" data-semver="1.4.8" src="https://code.angularjs.org/1.4.8/angular.js"></script>
<script src="App.js"></script>
</head>
<body>
<div ng-controller="mainController">
<my-custom-directive ng-show="someValue >= 0"></my-custom-directive>
</div>
</body>
</html>
var myApp = angular.module('myApp', []);
myApp.controller('mainController', function($scope) {
$scope.someValue = 0;
});
myApp.directive('myCustomDirective', function() {
return {
restrict: "E",
replace: true,
transclude: true,
template: "<div ng-show=\"options != null\">My Custom Directive</div>",
compile: function(element, attrs) {
return {
pre: function(scope, element, attrs) {
scope.options = {};
},
post: function(scope, element, attrs) {
}
}
}
}
});