Getting Started with Angular

User Model

Our user model will ensure that anytime we create a user, we are not passing in erroneous parameters in.

export class User {
  id: number;
  name: string;
  username: string;

We can use this in our components by importing it and then setting an objects type to it:

import { User } from './shared/models/user';


export class AppComponent {
    myUser: User;

Like this article? Follow @chrisoncode on Twitter