Code Monkey home page Code Monkey logo

Comments (4)

whitehat101 avatar whitehat101 commented on September 23, 2024

Are you getting HTTP GET requests (in the console)? If you have a catch-all route in rails, and angular doesn't find the template in the cache it will make a GET to that URL. The catch-all would explain how the wrapping layout got into the cache.

Try setting:

# config/environments/development.rb
config.assets.version = "something new" 

If you already had templates in your assets dir, sprockets probably cached them and isn't recompiling because it believes the source template has not changed (and is just serving html, instead of the js that injects the templates into the cache)

I've been thinking about tying ART's version into the config.assets.version to help deal with sprockets caching quirks, but I haven't gotten to it yet.

from angular-rails-templates.

WesleyKapow avatar WesleyKapow commented on September 23, 2024

Ah! Ok so the layout getting wrapped was definitely as a result of my rails route catch all.

And the reason why angular was not finding my partials in the templateCache (causing it to issue a get to rails and thus getting the layout), is because I have a foo.js and directives/modal.js in my /assets/javascripts. This collides with the js files being generated by angular-rails-templates. So the question is, what's the best solution here? Can I get the generated js files to be at /assets/templates instead of /assets?

from angular-rails-templates.

WesleyKapow avatar WesleyKapow commented on September 23, 2024

Ah my templates are under /assets/templates and not /assets/javascripts/templates which is why I'm running in to this and not you/others.

from angular-rails-templates.

WesleyKapow avatar WesleyKapow commented on September 23, 2024

Maybe add something to the readme that indicates it makes .js files for the templates and that these can then collide with existing js files.

Closing as this turns into normal asset pipeline behavior.

from angular-rails-templates.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.