简体   繁体   中英

How to select an Angular 2 Array Object from JSON

I am very new to Angular 2, and I am having trouble with what I feel is a small, but frustrating problem.

I am building a SPA with two main pages, the admin page and the actual app homepage. The admin panel needs to be able to update several text fields on the home page using a form on the admin panel.

The trick for me is that everyday, the info on the homepage will have different content, and the admin panel needs to be able to input info for future dates using the form, which when the date rolls around, will automatically update the homepage info.

My question is, how can I create a JSON document that holds all of the objects containing the info for the homepage, and then display that date's info on the homepage by filtering the JSON from that date?

If there is a better approach or solution, I would be very grateful to hear it!

First, your Angular2 app will completly run on the client side. So there is no possibility to create a JSON-file. You will need a backend-server. Your Angular2 app will GET/POST the content from/to the backend.

And better than a JSON-file would be a database (MySql, MsSql, Postgre, MongoDb, ....)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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