Comments (4)
Hey @lcottingham and thanks for the question,.
You could generate a URL using https://github.com/imgix/js-core 's _buildURL
and _buildSrcSet
functions and pipe that into the background-image
property of a component. Were you looking to implement this yourself or hoping for a separate component in this library that fits this use case?
from angular.
@sherwinski thanks for getting back to me 👍
Yes, very true - I could. Ideally, I was looking for a separate component in this library to fit the use case. It just could be a simple bool parameter (something like imgIxBackgroundUrl
) that is added to help direct the component logic. For now, I have written a generic quick and dirty method to build the URL that I can pipe into, but it's in no way perfect.
Incorporating the js-core API methods into this package would be helpful. Yes, I could install both but i'd still have to declare two different ImgIx clients to do a very similar job. This isn't really ideal for me.
Could we look at expanding the capability slightly to recognise even just a <div>
tag?
Currently we have:
<img ixImg path="examples/pione.jpg" sizes="100vw" />
What about if we have? (just like we have disableVariableQuality
)
<div ixImg path="examples/pione.jpg" sizes="100vw" imgIxBackgroundUrl>...</div>
The output of this would be:
<div style="background-image:url('https://imgixsrc.net/path?qryParams...')">...</div>
from angular.
@lcottingham Totally agree that having dedicated component/logic for handling this would be most ideal. And I think that something like your suggested approach could work for those purposes.
I've made a note of this in our backlog but unfortunately can't commit to a timeline as our team is pretty heads-down working on other projects at the moment. For now I'll keep this issue open and post any updates here as they happen.
from angular.
Perfect - I can work with my workaround for now 👍
from angular.
Related Issues (12)
- The automated release is failing 🚨 HOT 4
- ERROR Cannot find module 'imgix-url-params/dist/parameters.json' HOT 6
- Infinite loading loop ngAfterViewChecked in setSrcAndSrcsetAttributes HOT 6
- Action Required: Fix Renovate Configuration
- Dependency Dashboard
- Load event firing infinitely HOT 3
- The automated release is failing 🚨 HOT 4
- Angular Dependency Upgrade 13/14 HOT 3
- Dynamic image update is not working properly HOT 3
- Bump support to angular 14/15 HOT 2
- Deprecated
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from angular.