How to hide an element after $compile?

Posted by Miron on Stack Overflow See other posts from Stack Overflow or by Miron
Published on 2014-08-21T09:41:43Z Indexed on 2014/08/21 10:20 UTC
Read the original article Hit count: 133

Filed under:
|

How to hide directive generated html after inserting it to body? Directive has "replace" set to trueThere is a directive:

.directive('location', function () {
        return {
            restrict : 'A',
            scope    : {},
            replace  : true,
            templateUrl: 'common/components/location/location.html',
            link     : function (scope, element, attr) {……}
        }
});

So it is used in another directive:

var scope     =  $rootScope.$new(true);                
var directive = $compile('<div location></div>')(scope);

$document.find('body').append(directive);

directive.hide(); - not working

How to hide directive generated html after inserting it to body? Directive has "replace" set to true

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about angularjs