1

I'm working on an embedded VF page single page app and attempting to setup routes using ui.router ($stateProvider). I would like to break apart my views into inline templates but place them outside of the controllers. I keep running into an issue where when attempting to inject a template via the route I encounter a CORS error. For some strange reason, Salesforce appears to be prefixing a "c." in front of the base domain.

I would love some advice on how to setup an SPA with inline templates since packaging them in a zip archive is sort of overkill for this project. I'm also note sure how this would circumvent this CORS isssue.

  • Any luck in whitelisting the domain in CORS setting. – Praveen Jul 28 '16 at 6:29
  • No luck at all. – user34842 Jul 28 '16 at 11:53
0

I'm not particularly familiar with Angular but it seems odd to me that VF would be modifying something that's simply inline in the page, though I guess it's a side effect of the routing and using relative paths or similar.

Packaging in a zip can be painful if you use the standard UI, but a lot of the IDEs and tooling now offers support for static resources that make life far easier. For example, MavensMate offers Resource Bundles which are very simple to use. I work with these every day, I can simply edit my JS, and then hit command-shift-p (I use a Mac), type dep and then hammer enter twice to have everything zipped and sent up to the server.

  • Thanks for the response. I've been working with Welkins IDE (beta). It zips and unzips archives automatically which is cool, but you can't add new files via the IDE. As far as the issue goes I think it might be where the VF page stored. I read somewhere that VF pages are stored at //c.(domain)/ and the record page is stored at //(domain)/. So when you make a call to get a template, the origin is different than the target. I'm just confused because I've seen SPA's in Angular. So confused. – user34842 Jul 28 '16 at 0:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy