Angular 템플릿의 객체 속성

마크업에서도 객체를 출력할 수 있습니다. 실제로 살펴보겠습니다. 다음 객체가 있다고 가정해 봅시다:

app/app.component.tsexport class AppComponent {
  public obj = {'a': 1, 'b': 2, 'c': 3};
}

마크업에서 객체의 내용을 출력해 보겠습니다:

app/app.component.html<div>
  {{ obj.a }}
  {{ obj.b }}
  {{ obj.c }}
</div>
Задание 1

다음 객체가 주어졌습니다:

app/app.component.tsexport class AppComponent {
  public user = {
    name: 'john',
    surn: 'smit',
  };
}

이 객체의 각 요소를 별도의 단락에 출력하세요.

Задание 2

다음 객체가 주어졌습니다:

app/app.component.tsexport class AppComponent {
  public user = {
    img: 'pic.png',
    alt: 'picture',
  };
}

이 객체의 요소를 사용하여 다음 마크업을 출력하세요:

app/app.component.html<img src="pic.png" alt="picture">