thewildpendulum / angular-phonegap-seed

A barebones seed project for getting started with PhoneGap and AngularJS (with routing!)
107 stars 26 forks source link

doesn't work #4

Closed DexterMorg4n closed 10 years ago

DexterMorg4n commented 10 years ago

with Angular 1.2.6 it's not working even changing the urlSanitizationWhitelist to aHrefSanitizationWhitelist + domain whitelist doesn't fix it

Any ideas?

thewildpendulum commented 10 years ago

Hard to say without more information. Did you make sure to update your index.html? I know that's bitten me a few times.

DexterMorg4n commented 10 years ago

Yes. I did everything humanly possible. It can be because you used 1.2.0 and now it's 1.2.6 ? When using templateUrl in $routeProvider this is what I get: Cross origin requests are only supported for HTTP. When putting up on http server: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'null' is therefore not allowed access. And yes, it has .htaccess Access-Control-Allow-Origin "*"

On a http:// server works, on phonegap it doesn't work

thewildpendulum commented 10 years ago

Hmm. I'll see if I can reproduce it, though it'll be a couple days before I can get to it.

This project also exists so an Angular generator. You might have better luck with that.

DexterMorg4n commented 10 years ago

I managed to make it work by putting a .php URL with custom headers and works remotely inside phonegap. but the point is to store templates locally and do only json queries.

What would be the best thing ever is to work in phonegap with $routeProvider with local storage.

thewildpendulum commented 10 years ago

Unfortunately, I won't be adding anything like that to this project. The aim is keep things to the barest possible minimum since projects can have wildly divergent requirements.

I have, however, actually done that very thing before and it works quite nicely. Though, I've found it's really only worth the extra effort of adding localStoring if you're using it for something else, too, since there much simpler ways of dealing with templates by themselves.

DexterMorg4n commented 10 years ago

Well,in my case, I will be using it for lots of different types of data store, cache, update (on request) and make an overall UX much smoother.

The app I'm building now is quite big and localstoring makes sense.

Can you forward me to some solution? On Dec 26, 2013 4:43 AM, "Tim Hemphill" notifications@github.com wrote:

Unfortunately, I won't be adding anything like that to this project. The aim is keep things to the barest possible minimum since projects can have wildly divergent requirements.

I have, however, actually done that very thing before and it works quite nicely. Though, I've found it's really only worth the extra effort of adding localStoring if you're using it for something else, too, since there much simpler ways of dealing with templates by themselves.

On Wed, Dec 25, 2013 at 10:59 AM, gabrielpaunescu notifications@github.comwrote:

I managed to make it work by putting a .php URL with custom headers and works remotely inside phonegap. but the point is to store templates locally and do only json queries.

What would be the best thing ever is to work in phonegap with $routeProvider with local storage.

— Reply to this email directly or view it on GitHub< https://github.com/thewildpendulum/angular-phonegap-seed/issues/4#issuecomment-31202111>

.

— Reply to this email directly or view it on GitHubhttps://github.com/thewildpendulum/angular-phonegap-seed/issues/4#issuecomment-31209507 .

thewildpendulum commented 10 years ago

I wasn't referencing any particular resource when I tried this myself, but the set up is trivial.

I normally precompile all my templates and load them into an object hanging off my app's namespace. So, to create a similar experience, I sent down all my templates on page load and cached them in localStorage while bootstrapping. That's really all there is to it. To make things a bit easier on myself, I made a small wrapper module to mediate, so that I could just do template('templateName') and have it return what I wanted.

I had plans to allow dynamic loading of templates, such that I would only start with what I needed (the main views and maybe one or two others depending on flow). Requests for templates that I hadn't loaded would check the cache (and find nothing) and then fetch from the server, caching that template for future use. Nothing too complicated.

Now this was all for a rather small project, so I can't speak to how it would hold up to what you're doing. In theory, it's a decent mobile strategy, but I don't have anything to back that up.

Good luck!