简体   繁体   English

如何使用Angular4进行Codeigniter视图?

[英]How to use Angular4 to Codeigniter view?

First, I have PHP Codeigniter project currently run on server 首先,我有当前在服务器上运行的PHP Codeigniter项目

Then I've installed latest Angular4 CLI (Typescript) to server But I don't know how to integrate with Codeigniter project. 然后,我已经将最新的Angular4 CLI(Typescript)安装到服务器上,但是我不知道如何与Codeigniter项目集成。

How to use Angular4 in Codeigniter views like an AngularJS? 如何在Codeigniter视图中像AngularJS一样使用Angular4?

I guessed, Should I run ng-build every time? 我猜,我是否应该每次都运行ng-build for use compiled .js file to PHP view 使用已编译的.js文件到PHP视图

Any Idea? 任何想法?

Okay, I missed the first line in your question as I answered in the comment, you already have a project written in CodeIgniter and now you want to integrate Angular 4 as a view into this project. 好的,我在评论中回答时错过了问题的第一行,您已经有一个用CodeIgniter编写的项目,现在您想将Angular 4作为视图集成到该项目中。

I think you might be able to try it this way, move your CodeIgniter views to Angular views, and since controller->view in CodeIgniter already communicate via JSON, you should be able to turn your CodeIgniter to web service and send back the response as JSON that will be used later by Angular view. 我认为您也许可以这样尝试,将CodeIgniter视图移动到Angular视图,并且由于CodeIgniter中的controller-> view已经通过JSON进行通信,因此您应该可以将CodeIgniter转换为Web服务,并以稍后将由Angular视图使用的JSON。

Sorry but I don't know it can be done in another way or not, hope you find the approach soon. 抱歉,我不知道可以用其他方法完成此操作,希望您尽快找到方法。 (if possible, I hardly recommend you to separate client from the server) (如果可能,我几乎不建议您将客户端与服务器分开)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM