awulder / angular-prismicio Goto Github PK
View Code? Open in Web Editor NEWAngularJS service for prismic.io
License: MIT License
AngularJS service for prismic.io
License: MIT License
Hi,
Can you add an ordering method? Maybe something we can use like that :
Prismic.query(predicateBasedQueryString).order(orderingQueryString)
For now, I ended up using the api() method. It works fine, but it would be easier if there is a built-in method.
Thank you!
Love the lib, especially the prismicHtml directive!!!
Would love to remove your lib from my repo, though. Did you have any plans to push this up to Bower (or other similar services)?
Hey there I started using this to try some Prismic in Angular however I see here its used a format of quering that is on the old docs
Prismic.query('[[:d = at(document.type, "venue")]]')
Whereas now the syntax is more like: prismic.Predicates.at('document.type', 'venue')
I know this hasn't been updated in a while but still I'd be nice.
Thanks for this awesome service though
Link is broken.
Hi
Since the Prismic service caches the Api and Context with maybeApi and maybeContex there is no clear way to effectively change the accessToken except in app.config() with the PrismicProvider object.
This means we have to do a full page reload/redirect when editors and publishers want to view different versions.
To be clear, while it is possible to use Prismic.setAccessToken() and also Prismic.configuration but when retrieving the context or api we get the cached with the old access token.
Suggestion, when using any of the setAccessToken etc. methods, make the maybeApi and maybeContext is cleared. So that the next request will fetch fresh data. I would also suggest broadcasting something.
If you think this is a good idea I can implement it.
Some errors returned by server are lost when, for eg., a bad predicate is provided.
Prismic.all().then(function(data) {
self.data = data;
// If server error, data is null
});
If I want to chain several http calls, I can't chain promises because I need to test data
content.
A better design is to handle error here and here and to reject the promise.
Strangely, this design is already used here and here.
Do you agree ?
I can't seem to get this to ever work.
I'm running a query in my controller and getting back good data. But the directive shows nothing (the
tag at the end shows the results fine.)
controller code:
Prismic.query('[[:d = fulltext(my.product.name, "Coconut")]]').then(function(data) {
self.data = data;
}, function(err){
alert('error');
});html code:
<prismic-html fragment="main.data.product.name"></prismic-html>
<pre> {{main.data | json}} </pre>
It could be useful, to use maybeRef
in URLs that are built outside of a structured text fragment's serialization, or simply to build a URL from a document.
Ideally, it's be nice to just go: <a href="#/pricing{{ctx.maybeRef}}">...</a>
or <a href="{{ctx.linkResolver(someDoc, ctx)}}">...</a>
.
This directive no longer works after updating to Prismic.IO 1.3.3
They changed the return values from value to blocks.
I will continue to use 1.2.1 for now, but I'm hoping you can release a fix.
TIA
Thanks for writing this, going to try implementing today, can you tag a release for bower so I have a version to point to.
I'm trying to specify a particular form (not 'everything') for a query, but can't find any example or doc.
Should I use the Api (i.e. Prismic.Api) instead?
any help would be appreciated.
TIA,
Andrew
So that you can go <prismic-html document="someDocumentObject"></prismic-html>
.
Once more, I can work on it, I'm just interested in your opinion first.
Any plans to update this to support the new Previews and Experiments?
Hey,
What's the browser support for this angular module? Currently, I can't make it work on IE9. I'm getting a (very explicit...) error in the console :
Error: Access is denied.
The Prismic.io JS SDK supports IE9+ : prismicio/javascript-kit#20
Any help appreciated!
Thanks!
I'm trying to use the service but getting an error about access control
OPTIONS https://lesbonneschoses.prismic.io/api (anonymous function) @ angular.js:10695sendReq @ angular.js:10514status.$get.serverRequest @ angular.js:10221processQueue @ angular.js:14678(anonymous function) @ angular.js:14694parent.$get.Scope.$eval @ angular.js:15922parent.$get.Scope.$digest @ angular.js:15733parent.$get.Scope.$apply @ angular.js:16030done @ angular.js:10545completeRequest @ angular.js:10717requestLoaded @ angular.js:10658
(index):1 XMLHttpRequest cannot load https://lesbonneschoses.prismic.io/api. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:9000' is therefore not allowed access. The response had HTTP status code 404.
I'm assuming there is an underlying error, but not sure what to do here.
TIA
Andrew
I'm looking into your library today, and I'm noticing that you are abstracting a lot how the kit performs queries. It's fine by itself, but it suppresses a key upside of the official kit: the ability to chain calls to specify your query. For instance:
api.forms('products').query('[[:d = at(document.tag, "featured")]]').orderings('[product.price]').pageSize(10).page(2).ref(ref).submit()
I wonder how best to expose this with the current approach. Maybe simply with a Prismic.api
so that we can do stuff such as Prismic.api.forms('products').query('[[:d = at(document.tag, "featured")]]').orderings('[product.price]').pageSize(10).page(2).submit()
. This might require to extend the original SearchForm
object so that submit()
returns a promise, but that could work!
Notice that I haven't used ref
. I like the way you've abstracted the call to ref
in a clean way, still making it possible to pass another ref in the page's URL.
I can totally make that happen, I just thought I'd reach out first to talk about how to do this best.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.