1

I have implemented a project in CodeIgniter 3 which is running in CodeIgniter environment. Now I have installed the latest version of Angular (version 7). I have seen that these two are separate projects. Codeigniter is running in my server using the URL like http://example.com/ whereas Angular is running in http://localhost:4200 (why is this I don't know). My question is:

How to run my project using CodeIgniter environment (like using URL http://example.com/) with the Angular so that I can apply it in CodeIgniter environment?

Any help will be appreciated.

Thanks

Armali
  • 14,228
  • 13
  • 47
  • 141
  • 1
    Possible duplicate of [How to use Angular4 to Codeigniter view?](https://stackoverflow.com/questions/44897148/how-to-use-angular4-to-codeigniter-view) – elpidaguy Oct 31 '18 at 08:46

1 Answers1

3

You can not just combine these two different frameworks together to work like this. You can write your APIs in PHP CodeIgniter and consume it inside your angular 7 Project (or any other front end framework).

Remember Angular is front end framework which only send request to your server for fetching the data.

elpidaguy
  • 475
  • 8
  • 17
  • 1
    I agree with this – Dinesh Ghule Oct 31 '18 at 08:52
  • Thanks for your answer. This may resolve my issue if I run the project in Angular environment (like using URL http://localhost:4200) using Codeigniter as back end . But my problem is I have an existing Codeigniter project and so all the design part of this project are done. So how to integrate this into the Angular? Also how do I host it to the server so that it will be run by using the URL like http://example.com. – Suramya Chakraborty Oct 31 '18 at 09:39
  • To answer your second question first, run ng build inside your root dir, then upload dist folder on your server and then run http server refer : https://stackoverflow.com/a/44393334/9144250 – elpidaguy Oct 31 '18 at 10:39
  • Why you want to have angular if you already have your project in codeigniter – elpidaguy Oct 31 '18 at 10:39
  • 1
    Thanks for your answer. It seems to be resolved my issue. I will try it. Actually in my Codeigniter project, a critical graph to be implemented with filtering and annotation. So I am using angular. – Suramya Chakraborty Oct 31 '18 at 11:46
  • @SuramyaChakraborty great...feel free to mark my answer as accepted by clicking on tick icon and upvote the same. :) – elpidaguy Oct 31 '18 at 13:11