Answer the question
In order to leave comments, you need to log in
How to hide an element after inserting into body?
There is a directive:
.directive('location', function () {
return {
restrict : 'A',
scope : {},
replace : true,
templateUrl: 'common/components/location/location.html',
link : function (scope, element, attr) {……}
}
});
It is used like this:var scope = $rootScope.$new(true);
var directive = $compile('<div location></div>')(scope);
$document.find('body').append(directive);
directive.hide(); - не работает
Live example: plnkr.co/edit/e7fNua?p=preview CanAnswer the question
In order to leave comments, you need to log in
.directive('location', function () {
return {
restrict : 'A',
scope : {},
replace : true,
templateUrl : 'part.html',
link : function (scope, element, attr) {
element.hide();
}
}
})
body.append(directive);
setTimeout(function () {
body.find('[data-location], [location]').hide();
}, 250);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question