Watch a live product demo 👀 See how Sanity powers richer commerce experiences

How to Get Started with Sanity and Angular

9 replies
Last updated: Apr 12, 2021
Hello Sanity peeps! I see lots of starter projects for Sanity in use with NextJS, Vue, React, etc but not Angular. Is this because it’s not very compatible, or because it’s trivial to connect Angular to the Sanity API with a simple HTTPClient and send it a query string and therefore not worth an entire tutorial? I’d love to see a Stackblitz of Sanity with Angular!
Apr 11, 2021, 6:04 PM
Hi! Yes, it's like you said.But for handling portable text, it's nice to have already made component for your library. I'm sure there's one for Angular.
I also remember seeing this course in the twitter feed not long time ago:

https://explorers.netlify.com/learn/angular-dynamic-data-with-sanity-io
Apr 11, 2021, 6:58 PM
Great! I’ll check it out. Yeah the articles and tutorials I did find are for Angular but also include other technologies I don’t necessarily want to add right now like Netflify hooks, Angular Univeral server-side rendering, etc etc. I’m excited to connect to Sanity and get rolling! 🙂. But this will get me aware of those technologies and add them in the future when I understand the use case for them. Thank you for the link!
Apr 11, 2021, 7:09 PM
ah yes, sure, you don't need all of those, especially if you're building a SPA.I recommend using this client:
https://github.com/rexxars/picosanity
Apr 11, 2021, 7:39 PM
for rendering images, I use, like almost everybody here I guess, this library: https://www.sanity.io/docs/image-url Besides all the images manipulation capabilities, the main advantage for me is that I can just pass it an image asset and it will automatically resolve the URL of the image (otherwise you have to resolve the reference yourself inside the query).
Apr 11, 2021, 7:43 PM
and I highly recommend you make query using GROQ. I love that query language!
Apr 11, 2021, 7:45 PM
Yeah my brain really took to the GROQ syntax when I saw a video about it. And that image-url builder looks sweet. Thanks! It’s going to be a fun Sunday checking all this out!
Apr 11, 2021, 8:05 PM
Hey
user E
, why is Sanity always paired with Netlify functions and never just used as an endpoint with query strings at the end for queries? What am I missing?
Apr 12, 2021, 12:34 AM
It's strange that in this tutorial data are fetched through a Netlify Function. I guess Netlify just wanted to showcase this feature.I would only use serverless function if I'm working with a private dataset.

Also, you're building a SPA (no server rendering at build time), you also don't need to use Netlify build hooks.
Apr 12, 2021, 6:12 AM
Ok thank you for confirming. I thought it was to build complex queries that contain characters that would not be accepted as a query string like
?query=*[2]
but I could always convert those to html encoding like
%20
and all that
Apr 12, 2021, 1:11 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
After adding the subtitle and running this code npm run graphql-deploy It does nothingSep 15, 2020
how to limit a reference to just one entry in Studio reference input side versus the default as-many-entries-as-you-fill-in-an-array...Sep 18, 2020
Is it possible to fetch more than one "_type" using GROQ?Nov 2, 2020
I want to add a view with the Structure builder (S.view.component) where I list similar documents based on the title. What...Sep 23, 2020
Is there a structure builder example where the format of each preview for the document list is modified?Feb 3, 2021
I have an array of references to a country schema type but it always just returns NULL values for meJan 30, 2021
Hi, I need help with a query for getting the url of an image asset. Here is what I've been trying, but I only get the _ref...Dec 1, 2020
Sanity UI looks brilliant :smiley: Is something like the current date picker possible at the moment? I’m not sure if anicon...Dec 21, 2020
Hey everyone. I have been coding and may have potentially accidentally deleted something. Does anyone know how to resolve...Dec 26, 2020
Hello everyone and happy new year :raised_hands::skin-tone-2:, I have a problem with outputting Portable Text :disappointed:...Jan 1, 2021

Related contributions

Clean Next.js + Sanity app
- Template

Official(made by Sanity team)

A clean example of Next.js with embedded Sanity ready for recomposition.

Cody Olsen
Go to Clean Next.js + Sanity app

Blog with Built-in Content Editing
- Template

Official(made by Sanity team)

A Sanity-powered blog with built-in content editing and instant previews.

Go to Blog with Built-in Content Editing