O'Reilly logo

Rails, Angular, Postgres, and Bootstrap by David B. Copeland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Serving Angular Templates from the Asset Pipeline

The way we’ve configured our routes, Angular will ask the server for the file /customer_search.html, which will result in a 404. We could place our view file in public, but most Rails deployments do not serve static assets from that directory, preferring to serve them from a CDN or a web server. Ideally, we want our templates managed the same as all other assets—through the asset pipeline.

That this is an HTML file poses a bit of a challenge, especially if we are using a CDN. Because our assets would be served from a different server on a different domain than our Rails application, most browsers won’t allow Angular to fetch the HTML file without configuring the CDN server for cross-origin ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required