Hide a directive from within


#1

Hi,
I’m looking to hide a directive, when a user clicks a button within it.
This is what i tried:
template:

 <div>
        <button class="button button-positive" ng-click="hide()">
             Hide
        </button>
    </div>

the directive:

.
.
.
controller: function($scope, $element) {
       $scope.hide = function() {
            $element.style.display = "none"; //error here. style not found on $element
      }
}
.
.
.

How should it be done (if possible).


#2

You can use ng-show and ng-hide just google it a bit, can’t get easier than that.


#3

Awesome!
I didn’t know the page is updated for event changes.

Thanks!


#4

And you only had to ask :smile: