3

If the title question is unclear, let me clarify. Though the question is conceptual, rather than physical.

I have a rails application with a few models (order, buyer). I recently discovered angularjs and noticed that it is a very powerful tool, however, I, obviously, would not like to convert my project.

I'm particularly interested in the data-binding of angular, aka how the info of views can be instantly updated (without page reload). So, is there a way to use angular but take the data from the rails model, instead of the angular model?

If this isn't possible, feel free to comment with a different way to go about this.

1
  • angular can not connect with your database as rails model does but if you make a json , you can use it in data binding by angular js Commented Jul 31, 2014 at 18:21

1 Answer 1

1

Here's what a move to Angular with Rails would mean to me.

  • Rails does not do any server side HTML templating.
  • Your web server serves static files - HTML (angular views), CSS, and JavaScript.
  • Rails serves an API (your Rails models being serialized to JSON).
  • There isn't really a model to recreate on the Angular side. You get JavaScript objects back from the web API calls. Controllers, Services, and Directives do a lot of the work in Angular.
  • You choose when to send requests to the server in Angular. Update whenever your app needs to.

I think it's helpful to think of your Angular app like any other client of your Rails API.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.