How to set Angular 4 background image?
You can use ngStyle to set background for a div or you can also use built in background style:
You can use ngStyle to set background for a div or you can also use built in background style:
You can do something like this: jsfiddle Edit: Thanks HATCHA and jpsetung for your edit suggestions.
You should use val instead of value.
Based on comments below, it no longer works in modern browsersThis question demonstrates an approach that might be helpful to you: Silent print an embedded PDF It uses the <embed> tag to embed the PDF in the document: Then you call the .print() method on the element in Javascript when the PDF is loaded: You could place the embed in … Read more
Ok, think I may have found it: the site runs fine in Chrome’s incognito (porn) mode. So I strongly suspect I’ve got some kind of extension that’s interfering with it (like Do Not Track or something). EDIT It’s Collusion’s “block known tracking sites” feature.
Since the question refers to a single element, this code might be more suitable: It is the same as twernt’s suggestion, but applied to a single element; and it matches the algorithm recommended in the jQuery FAQ. We use jQuery’s is() to check the selected element with another element, selector or any jQuery object. This method traverses along the … Read more
Use .height() like this: There’s also .innerHeight() and .outerHeight() depending on exactly what you want. You can test it here, play with the padding/margins/content to see how it changes around.
It’s because val is not null, but contains ‘null’ as a string. Try to check with ‘null’ For an explanation of when and why this works, see the details below.
Use jQuery to get the width of the window.