dongque20030402 2016-09-14 08:58
浏览 40

使用Angular.js和php显示数据库行的值

I am in the process of building a interface where app info is displayed to the owner. This consists of a table showing stats like:

Who created the channel on the app.

When was it created.

What is the status of the channel.

How many subchannels it contains

and so it goes.

All of the above mentioned data is obtainable from a database and I could easily echo the table data using a while() or a for loop.

However

I would very much like to start implementing and learning angular

And how I understand, it is that I would have to create an array of each database field in the row and then, using array_push, I would push data in an array for use in JS.

However this would be very time consuming as well as inefficient, which leads me to believe I might be going about it all wrong.

The reason for choosing angular is because I read it is quite easy to sort and filter table data and it seems like a great framework to learn.

So how should I correctly apply angular to my situation to have it work optimally?

  • 写回答

1条回答 默认 最新

  • duandu2159 2016-09-14 09:59
    关注

    Angular consumes only JSON so, now you are not going to echo the data to create the html output.. instead you need to use PHP to create a WEB API responds with JSON data when requested.

    So, you Angular application will send request to PHP which in turn returns a JSON which can be used angular to show the data, apply filter and what not.

    评论

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能