Skip to content

Hero Model

Thor Schueler edited this page Mar 10, 2017 · 7 revisions

The Hero model implements the model for the Hero Component. An instance of the model is generated and delivered by the Hero Service.

Properties

The Hero model is a POCO has the following properties:

  • Name - Gets the display name of the current user
  • Picture - Gets the url for the user's picture
  • Email - Gets the user's email address
  • UserId - Gets the user's login id
  • Profile - Gets the url for the user's profile page.

Constructor

You can construct a new Hero model instance using the its constructor:

    constructor(id: string, name: string, email: string, picture: string, profile: string)

Parameters:

  • id - String containing the user's login id
  • name - String containing the user's full name
  • email - String containing the user's email address
  • picture - String containing a url to the user's pricture
  • profile - String containing a url to the user's profile page

Example

The following example implements a simple ng2 component using the Hero model to display the users name and email:

    let u:Hero = new Hero(
            'tschueler',
            'Thor Schueler',
            '[email protected]',
            'https://media.licdn.com/media/AAEAAQAAAAAAAAT-AAAAJDdiZTQ3OTI3LTMzM2YtNDYzZi1iMzUxLTc5ZTY3NTY0OTFhNg.jpg',
            'https://www.linkedin.com/in/thorschueler/'
        );
Clone this wiki locally