1

I have created rails app and inside it i created Angualr2 app .. right now i have to start both angular server and rails server ... but i want to show angular2 front end when run rails s. how is this possible. what i have try is 1) run ng build and load all files of dist folder in rails public folder 2)replace yield with <app-root>Loading...</app-root> . if now i run rails s its show me same rails page .. not loading... or app works. plz help me how can i integrate Angular2 with rails i am following this https://blog.angular.work/post/angular-cli-on-rails and this https://blog.angular.work/post/angular-2-on-rails. also i am using Angular-cli

1 Answer 1

2

Yes, it's now possible if you use Webpack and the Rails Webpacker gem.

You can then easily develop Angular components using TypeScript.

This gem is still in heavy development so you may want to use the master branch: https://github.com/rails/webpacker#ready-for-angular-with-typescript

Sign up to request clarification or add additional context in comments.

3 Comments

i should b done without any gems ... two links i posted above in post are not using any type of gem for this.. is there another way?
If you want the angular app to be served with the Rails server, you have to develop your Angular stuff directly in the public directory. It's way more clean to use a packer tool like webpack to manage the node modules and stuff. If it was easily done without any gem, the Rails team would not work on webpack and webpacker.
As i said i put all the ng build files in public directory but it still not working

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.