Angular js + Rails good idea? - javascript

I have been using rails as backend and some basic css, js for frontend. I am the only one in dev now, but I thought it's better to separate frontend/backend for later when someone else joins as frontend. I was googling for a bit and figured angularjs might be a good combination.
However, I don't quite get other benefits of this combination(rails + angular) other than making separating front-end jobs. What are the other benefits of having angular in rails framework or any cons?
Thanks a lot!
======== EDIT ==============
Sorry that my question was too broad in some way.
In short, I was wondering if there are any reason why angular is such popular combination with rails. Compared to just using rails for everything(front+back), what are some benefits of using angular on the front end + rails backend-api? (speed, simplicity, DRY-er code......etc?).
I just started googling angular for several days now, and before actually getting into it, I wanted to hear from people having experience in it. Thank you.

Angular + Ruby on Rails is a very popular combination. Use rails for api endpoints and angular to retrieve and display data. You can also do most pages with rails and only some components with angular depending on how complex your pages need to be.

Related

React + Springboot or Springboot only for a project?

My partner and I are building a project for a class this semester. I am currently doing research on what technologies we want to use. So far Springboot for the server side and MySQL or Postgres for the database are strong contenders. I wanted to ask if we should use React or even Angular for our frontend or should we just develop multiple JSP pages for our frontend? So far in my research I have not seen many people combine React and Springboot for projects and it makes me think perhaps I am combining two things not really meant to be combined. Can anybody assist us in deciding the tech stack?
Don't ever write server-side rendered user interfaces. Create a REST api for your backend so that you can have multiple clients querying such api: today, a web app written in angular or react, tomorrow maybe a mobile version.
It depends on so many factors. Some of them are the speed at which you want to finish the project and the quality of the project.
It is a good idea to learn at least one framework and Spring is a good fit.
Regarding the front end, JSP is not a good idea. Both Angular and React are fine as long as you want to learn and develop yourselves. Something in the middle, which may be a bit easier to digest would be Vue.js. Any of these would require a lot of time investment. Since you are already planning to learn Spring and Java then you may use a template engine to make your life easier, something like Thymeleaf. This is a bit old school but it may help you achieve faster results with what you already have.
You also have the option to go on the Javascript or Python directions.
There is no really good answer here, it all depends on what you know, what you want to learn, what you hope to achieve and, of course, the end result.

Laravel and Angular(JS), where to start with Angular?

I'm a software engineer and want to learn developing web applications with PHP and JavaScript. I'm familliar with C#, object oriented programming and working with frameworks.
So i decided to learn directly creating an web application based on a framework (Laravel, as we work with this framework on my work also). I start understanding how the framework works and as programming is not new for me i also understand the basics of PHP.
For the front-end i want to use Angular JS as i heard a lot of positive things about it. During my research on Google about Angular and Angular in combination with Laravel i read that we already have Angular V2 and V4.
I have a few questions about this:
What is the best version to start with? This because i heared the
good things about V1 (and the combi with Laravel), but V2 and V4 has
a complete other concept? I'm a bit confused if it has the same
purpose and if it is still a good approach to combine the newer
versions with Laravel?
I can find how to combine Laravel with AngularJS(1) and how to structure the project, but cant find a good tutorial or explaination how to combine/structure Laravel with
Angular 2 or 4. This also confuses me.... Are the newer versions not
a good combination with Laravel anymore?, Angular just uses Json
API's so why not? or are i'm wrong.
What i found about Laravel and the newer Angular versions is that it is a no-go to use both in 1 project. The advice is to use 2
different projects? I do not understand why as i can still make them
independed from eachtoher in 1 project by a nice folder structure.
So if this is true, what is the reason behind?
If it is no problem to combine both in 1 project, i prefer to do this. But what is the best practice to add Angular into the Laravel project? especially for the folder structure? Is there a tutorial which describes how to use these 2 frameworks in 1 project?
I hope that someone can give me a "kickstart" how to start with increasing my skills.
I would suggest using Vue.js instead if you are familiar with new Laravel 5.x. It is supported by default and plays together pretty good.
https://learninglaravel.net/topics/vuejs
In my previous projects I used Laravel 3/4 + Backbone.js. Backbone, to me, is much better then diving into a full framework that your entire structure ( html + js ) depends on multiple custom tags etc. Backbone gives you a better approach on that case that you can use it partially in some modules etc or you can build your entire layout with it.

AngularJS applications imply single page applications?

So I just spent the past 5 hours reading up on Angular JS. It seems like a lot of people are heavily associating this framework to single page applications especially when accommodated with a back-end MVC framework with nice API usage like Ruby on Rails or Laravel.
I have 2 main questions that have been boggling me:
How do you initialize such apps considering that the content is
dynamic in nature. When using something like RoR/Laravel, I'd prepare
the HTML with the dynamic data at the back-end and then serve the
initial pages. It seems like most people using Angular serve up a
basic skeleton of the HTML and then do a round trip to web server
again for some data. Is this really how its done? if not, please
suggest a the right way.
Secondly, I dont think I am about to embark on a project with a
single paged application in mind. Does that mean it would be overkill
to use AngularJS for my project. Does anyone have a use case that
they think is appropriate that would require AngularJS with non
single page application that jQuery cant handle easily?

Django Rest Framework and Angular

I am very new to Django Rest Framework (DRF) and AngularJs. What I wandering here is the best way to work with these two.
DRF and AngularJs together (Most of tutorials showed me this) in one project
DRF as backend and AngularJs in frontend as 2 different projects
I am very confused, though I feel the 2nd approach is better. But still not sure. Can please anyone help me in this with pros and cons of both the approaches.
I think the second one is better. In a restful-style project, front-end code is completely decouple with the back-end code.
Besides, separate them into two projects is good for deployment. If you want to upgrade the front-end code, just upload them and restart nginx, front-end code totally is static.

Does Angular.js work with Rails without needing an API?

I am very new to javascript and have mainly been learning Rails previously. I want to be able to make more dynamic websites that give a more dynamic user experience but I am not sure wether to learn Angular.js or JQuery. I want to still serve the web pages through Rails and do not want to get into learning how to build a full SPA and Rails API and connect the two yet.
On the one hand I can see JQuery would be good for adding dynamic interactions to my pages but I have also seen that Angular.js is very popular and many people have told me I should go straight into learning angular. I also like the idea of being able to eventually make full SPAs with Angular in the future.
My main concern is I do not feel ready to start learning how to completely separate my frontend and backend using a rails API and a Javascript framework and would prefer to just add some interactivity to my pages and continue furthering my knowledge of Rails.
Is it possible to use angular to add small amounts of interactivity to multiple pages without having a SPA front end and Rails API?
Thanks for any advice.
Of course you can.
Add html pages to your public folder and put a script reference to AngularJS and you are good to go.

Categories

Resources