Angular2创建模型

时间:2017-04-10 15:24:52

标签: angular typescript

我的服务器收到如下响应:

{
  "coreGoalId": 0,
  "title": "string",
  "effect": "string",
  "target_Audience": "string",
  "infrastructure": "string",
  "benefits": [
    {
      "benefitId": 0,
      "what": "string",
      "coreGoalId": 0
    }
  ],
  "steps": [
    {
      "stepId": 0,
      "what": "string",
      "coreGoalId": 0
    }
  ],
  "images": [
    {
      "imagelId": 0,
      "base64": "string",
      "coreGoalId": 0
    }
  ],
  "subGoals": [
    {
      "subGoalId": 0,
      "title": "string",
      "priority": "string",
      "audience": "string",
      "social_aspects": "string",
      "coreGoalId": 0,
      "issues": [
        {
          "issueId": 0,
          "title": "string",
          "subGoalID": 0
        }
      ]
    }
  ]
}

简而言之,CoreGoal有一些属性以及一系列好处,步骤等。它有SubGoals,而SubGoals又有很多问题。

为这种模式创建Angular2模型的最佳方法是什么?我将有一个HTTP GET请求,它将获取所有的coreGoals,并有一个HTTP PUT请求,它将更新单个CoreGoal。所以基本上我会在发出PUT请求之前手动构建这样的JSON对象。

我应该为福利,步骤等单独上课吗?

0 个答案:

没有答案