I have 2 elements like so:
<div ng-hide="showDiv"></div>
<div ng-show="showDiv">
<div directive></div>
</div>
And a directive like so:
app.directive ('directive', [
...
controller: [
'$scope',
function ($scope) {
$scope.accept = function () {
$scope.showDiv = false;
};
}
],
....
]
I tried to use $scope.showDiv within the directive to toggle the controller but it didn't work. How do I access the controller's scope within the directive?
console.log($scope) in the directive shows $scope.showDiv === false though $scope.showDiv === true in the controller.