Angular & MVVM

Model

Just file like user.class.ts

class User {
  name:string;
  email:string;
  address:string;
}

View

HTML template user.component.html of component

<main>
  <h3>{{ user.name }}</h3>
  <p>{{ user.email }}</p>
  <p>{{ user.address }}</p>
</main>

ViewModel

Typescript part of a component

@Component({
    selector:"app-user",
    templateUrl:"./user.component.html",
    styleUrls: ["./user.component.css"]
    providers: [UserService]
})
export class UserComponent implements OnInit {
  @Input()
  user: User;    
}

Похожие записи

RxJS Pipeable Operators

Начиная с версии rxjs 5.5 операторы вместо цепочки вызовов применяются как параметры функции pipe.

Angular. Can't set breakpoints in VS Code

Вариант решения проблемы, когда не срабатывают точки остановки при разработке Angular приложений в редакторе VS Code
10 апреля 2018 г. в Angular