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
Add a comment
|
1 Answer
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
3 Comments
omer khan
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?
Nicolas Blanco
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.
omer khan
As i said i put all the ng build files in public directory but it still not working