Starkers
Starkers

Reputation: 10541

Where to store angular templates in Rails?

I'm using angular.js as my clientside framework and rails as my serverside framework. One slight stumbling block is where should I store my angular view templates?

Let's say I'm making a custom directive:

directive("foobaz", function (cart) { return {
    restrict: "E",
    templateUrl: "components/bing/foobaz.html"
}

How should I serve up components/bing/foobaz.html? Should I put it in my public folder:

root/public/bing/foobaz.html

Or should I make routes and a controller to serve up angular views?

Upvotes: 0

Views: 173

Answers (3)

D.K.
D.K.

Reputation: 446

We have angular-rails application. And we store templates in app/assets/templates dir, and use haml for templates. For those purposes we're using angular-rails-templates gem

Upvotes: 0

Nikhil T Nair
Nikhil T Nair

Reputation: 101

Make a folder app/assets/templates/.

It will hold all of your angular templates. please refer this link to get more details http://start.jcolemorrison.com/setting-up-an-angularjs-and-rails-4-1-project/

Upvotes: 3

raj_on_rails
raj_on_rails

Reputation: 144

you can use layouts folder in

app -> views -> layouts

or with .yml, we can store it in config and no need to mention in routes.

Upvotes: 1

Related Questions