<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Michaela Hoffman</title>
    <description>The latest articles on DEV Community by Michaela Hoffman (@michaelahoffman).</description>
    <link>https://dev.to/michaelahoffman</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F651174%2F2809dc1a-4b93-4655-bc38-7ab4fa747d05.jpeg</url>
      <title>DEV Community: Michaela Hoffman</title>
      <link>https://dev.to/michaelahoffman</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/michaelahoffman"/>
    <language>en</language>
    <item>
      <title>Cross over between UX Design &amp; Front-end Development using the ORCA Process</title>
      <dc:creator>Michaela Hoffman</dc:creator>
      <pubDate>Fri, 09 Jul 2021 18:21:31 +0000</pubDate>
      <link>https://dev.to/michaelahoffman/cross-over-between-ux-design-front-end-development-using-the-orca-process-212f</link>
      <guid>https://dev.to/michaelahoffman/cross-over-between-ux-design-front-end-development-using-the-orca-process-212f</guid>
      <description>&lt;p&gt;I challenged myself to make a little Mars weather app using &lt;a href="https://api.nasa.gov/"&gt;NASA's Insight Weather API&lt;/a&gt;. As with most things I started pulling out all the docs and information to get my mind wrapped around what I was getting from the API to work with. And after looking at the docs for a bit I realized that one of the best ways for me to get my mind wrapped around the data was to apply the &lt;a href="https://www.objectorientedux.com/"&gt;ORCA process&lt;/a&gt; I've been learning. &lt;/p&gt;

&lt;h2&gt;Discovery&lt;/h2&gt;

&lt;p&gt;In these first two images,  you can see how I used the ORCA process to identify potential content and data from existing weather applications. I also took note of some cool UI that might translate well to my mars app like the gradient slider for AIR Quality could easily become a slider for Atmospheric Opacity. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-2.45.00-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--scoOZAu4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-2.45.00-PM-1024x560.png" alt=""&gt;&lt;/a&gt;Existing Earth Weather Application UI Research&lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-2.46.17-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S_FJAPrK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-2.46.17-PM-1024x628.png" alt=""&gt;&lt;/a&gt;Existing Earth Application UI research&lt;/p&gt;

&lt;p&gt;These two activities I was working on plug into each other so well. To give you a very brief overview the &lt;a href="https://www.objectorientedux.com/"&gt;ORCA process&lt;/a&gt; takes you through several activities that help you define the Objects of your user's mental modal which might be represented in the system. How all those objects you defined are related to each other by defining their relationships, what users can do to act upon those objects by defining Calls-to-Action, and exploring those objects in great detail to define the Attributes of those objects. &lt;/p&gt;

&lt;p&gt;Since I was working directly with an API was able to include that in my discovery process as well. I'm taking the data from NASA and turning it into a JSON object guess what?? It's organized as objects. Now I'm able to see and document what data I can get from this API and what its limitations are. This will also give me a jumping-off point for thinking about other APIs that I could potentially explore, the next image is a snapshot of the data coming back. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/04/image-3.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Iq4uTs0K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/04/image-3.png" alt=""&gt;&lt;/a&gt;InSight Weather API &lt;/p&gt;

&lt;p&gt;With this particular API, I'm only getting high-quality data which meant I may need to plan for missing content and attributes on any given sol (Martian Day). &lt;/p&gt;

&lt;h2&gt;Relationships&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-2.48.17-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ZyWJIPeW--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-2.48.17-PM-1024x721.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As part of Relationship discovery in the ORCA process, you make a little system model to start thinking about how the objects in your data set relates to each other. This was also something that the API was really helpful with. I had assumed, incorrectly, that the API would return one data point for the temperature for each Sol (Martian Day) but because I was working with an API I was able to see I would get at least 18 data points for temperature each Sol if the Sol passed the validity check.  &lt;/p&gt;

&lt;p&gt;Next, I translated my objects into an object map where I also added in all the attributes the API was going to return for me. Now onto translating this into UI and a functioning web app. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.00.54-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--uKsxexe4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.00.54-PM-690x1024.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Translating the Objects &amp;amp; Relationships to the UI&lt;/h2&gt;

&lt;p&gt;As I move from low-fidelity to higher fidelity through this process I build on what I've created before. Before I dig into the UI elements of the design I move through making some sketches of the objects. And through this process I'm figuring out how I want this data to display consistently to avoid shapeshifting. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.36.48-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UQpo6l_T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.36.48-PM-491x1024.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As an example, I sketched out a Sol mini card with just a few of the attributes from my map. Once I get to the grid card I added a few more attributes in, as well as, explored some UI elements like using an icon for representing atmospheric opacity. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.42.40-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w866zXob--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.42.40-PM-1024x718.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I've moved into the next level of fidelity but you can see how I'm using my object cards to create the UI for the application. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.41.28-PM.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--hVtQxiAG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/05/Screen-Shot-2021-05-21-at-3.41.28-PM-1024x655.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A a part of this project I wanted to take a peek at &lt;a href="https://tailwindcss.com/"&gt;Tailwind CSS&lt;/a&gt; and get the chance to work with that framework. I typically have worked with Bootstrap in the past and haven't gotten many chances to try other frameworks other than in my personal projects. &lt;/p&gt;

&lt;p&gt;Well, that looks nice to start with. I've got more fun stuff with the UI in mind based on what the data points are saying but that will be more fun when it's dynamic and not a static image. &lt;/p&gt;

&lt;p&gt;Speaking of that onto making it function and replacing the placeholder data with the real data from the API. &lt;/p&gt;

&lt;h2&gt;Moving into Functionality&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://michaelahoffman.com/wp-content/uploads/2021/04/image-5.png"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--w_vER-Sc--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://michaelahoffman.com/wp-content/uploads/2021/04/image-5-1024x488.png" alt=""&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Remember earlier in this conversation I said I'm getting only high quality data? As it turns out the API is not returning as much weather data as it could. Because of this most of my data points would end up reading No Data like in the screenshot above. &lt;/p&gt;

&lt;p&gt;What a bummer. &lt;/p&gt;

&lt;p&gt;Beyond realizing the data would be mostly empty most of the time and I would never be able to implement a search with the existing API. I got to work with the sort &amp;amp; find methods in this little project to bring back and display the most recent date separately from the rest of the days in my UI.  &lt;/p&gt;

&lt;h2&gt;A peek at the Code&lt;/h2&gt;

&lt;p&gt;First I assigned the sol number to the sol as an id and converted the result into an integer. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;constructor(data: IWeather) {
    const sols = data.sol_keys.map((k) =&amp;gt; {
      const sol: ISol = data[k];
      sol.id = parseInt(k);
      return sol;
    }); &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Now that I'm returning an integer I run that through the sort method to get an ordered array based on the sol id descending. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;const first = sols
      .sort((a: ISol, b: ISol) =&amp;gt; b.id - a.id)

// [858, 856, 855, 854]&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Looking good, now I used the find method to get the first result in the array which happens to be the largest one since the sorted array is in descending order.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;const first = sols
      .sort((a: ISol, b: ISol) =&amp;gt; b.id - a.id)
      .find((x: ISol) =&amp;gt; true);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once I have that I'm able to assign the result to the primarySol... properties of my class for the WeeklyWeather. Below you can see the final result. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;pre&amp;gt;export class WeeklyWeather {
  primarySolNumber: number;
  primarySolDate: string;
  primarySolSeason: string;
  sol: ISol[];

  constructor(data: IWeather) {
    const sols = data.sol_keys.map((k) =&amp;gt; {
      const sol: ISol = data[k];
      sol.id = parseInt(k);
      return sol;
    });

    const first = sols
      .sort((a: ISol, b: ISol) =&amp;gt; b.id - a.id)
      .find((x: ISol) =&amp;gt; true);

    this.primarySolNumber = first.id;
    this.primarySolDate = first.First_UTC;
    this.primarySolSeason = first.Season;
  }
}
&amp;lt;/pre&amp;gt;&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Dear NASA, please update your API so that I can pass a quality parameter and get lower quality data. ? This way I can finish out my little project! &lt;/p&gt;








&lt;p&gt;It was still really fun to experiment with utilizing the ORCA process on this little personal project. I also had a lot of fun saying things like "I'm receiving telemetry from NASA." And even getting to experiment with another CSS framework was fun and challenging. &lt;/p&gt;

&lt;p&gt;You can still see my public repo of the fledgling project on &lt;a href="https://github.com/michaelahoffman/mars-weather-app" rel="noreferrer noopener"&gt;GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you want to geek out about space, APIs, UX, the ORCA process or other things you can find me &lt;a href="https://twitter.com/md_hoffman"&gt;@md_hoffman&lt;/a&gt; on twitter! &lt;/p&gt;

</description>
      <category>ux</category>
      <category>design</category>
      <category>webdev</category>
      <category>tailwindcss</category>
    </item>
    <item>
      <title>Making a Mock Service for all the mock data</title>
      <dc:creator>Michaela Hoffman</dc:creator>
      <pubDate>Sun, 04 Jul 2021 23:40:56 +0000</pubDate>
      <link>https://dev.to/michaelahoffman/making-a-mock-service-for-all-the-mock-data-14dp</link>
      <guid>https://dev.to/michaelahoffman/making-a-mock-service-for-all-the-mock-data-14dp</guid>
      <description>&lt;p&gt;In this part of the tutorial I’m going to be making a mock service to house all my animal details. In the previous part of the mock data series I made a second set of classes for animals and identified the need to move them out to a single location.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making Magic
&lt;/h2&gt;

&lt;p&gt;Here is where the magic happens with this process. When I’ve identified duplicated data and move it to a central location not only does my code become more consistent and simplified but it is also more maintainable.&lt;/p&gt;

&lt;p&gt;It is true that I am often working in prototype code so it really doesn’t “matter” that I have some duplication going on. Or even that the code isn’t maintainable because it’s all a prototype right now anyway.&lt;/p&gt;

&lt;p&gt;I’m always pushing to make my code easier to fold into the process. I don’t want to spend time/effort/energy on writing the code just so someone else has to come back and rewrite it because I’m leaving it in a weird hard coded prototype state.&lt;/p&gt;

&lt;p&gt;Don’t get me wrong. I totally started there where everything was hard coded and sometimes at first pass I leave things hard coded until I know what I want to do with the experience. Then I go back through and clean it up so that the interaction design can be tested and fully experienced in the coded prototype.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating my service
&lt;/h2&gt;

&lt;p&gt;First thing I need to do is get my service created.&lt;/p&gt;
&lt;br&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ng g s animal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;Now that I have that created I am going to strip out my classes and interfaces from the other components and move them into the service. As I do this I combine them to make a single class eliminating the duplication.&lt;/p&gt;

&lt;p&gt;This is going to make more sense when you look at the full code file on github but now I’ve got one file that combines all the data from both spots. &lt;/p&gt;

&lt;p&gt;Here is a peek below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export interface IAnimal {
      guid: string;
      name: string;
      type: string;
      description: string;
      numberAtZoo: number;
      photo: string;
      animalInResidence: IAnimalInResidence[];
      food: IFood[];
      habitats: IHabitat[];
}

export interface IAnimalInResidence {
      name: string;
      personality: string;
      age: number;
}

export interface IFood {
      foodName: string;
}

export interface IHabitat {
      habitatName: string;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Newing up my animal instances
&lt;/h2&gt;

&lt;p&gt;First, I’m going to export a new abstract class in my AnimalService file. I want to be able to create this base class that will be extended by the mock service and not be instantiated which is where the abstract class is particularly useful.&lt;/p&gt;

&lt;p&gt;Within this abstract class I call the getAll method to return all my animals from my mock data set. &lt;/p&gt;

&lt;p&gt;I then called the abstract method get which takes an id and then returns an observable of type IAnimal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export abstract class AnimalService {
  abstract getAll(): Observable&amp;amp;lt;IAnimal[]&amp;gt;;

  abstract get(id: string): Observable&amp;amp;lt;IAnimal&amp;gt;;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Extending my abstract class
&lt;/h3&gt;

&lt;p&gt;Now that I’ve got my abstract class in place I want to extend the service to handle my mock data so I export a second class called the MockAnimalService and extend the Animal Service. &lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export class MockAnimalService extends AnimalService { … }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this class I call the getAll method and return my 3 new animals.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export class MockAnimalService extends AnimalService {
  getAll(): Observable&amp;amp;lt;IAnimal[]&amp;gt; {
    return of([
      new Animal1(),
      new Animal2(),
      new Animal3()
    ]);
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, I call the get method and pass in my guid. When I return the data from the get all method I then use the pipe() function to combine multiple functions. I then call map and get all the animals. I then use find to locate the animal with that guid.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;get(guid: string): Observable&amp;amp;lt;IAnimal&amp;gt; {
    return this.getAll()
      .pipe(
        map(x =&amp;gt; x.find(a =&amp;gt; a.guid === guid))
      );
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This has now made the guid accessible for me to use in the URL and link to the correct animal.&lt;/p&gt;

&lt;h2&gt;
  
  
  Routing to the animal
&lt;/h2&gt;

&lt;p&gt;This part is pretty straight forward but I want to include it anyway just in case it is helpful.&lt;/p&gt;

&lt;p&gt;In my routing.module I add the following to the routes variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{path: 'animals/:guid', component: AnimalComponent}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And within the animal list view I added the [routerLink] to grab that guid and build the route for me.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;a [routerLink]="['/animals', animal.guid]"&amp;gt;{{animal.name}} &amp;lt;/a&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Inside the animal.component.ts
&lt;/h2&gt;

&lt;p&gt;Now it comes to the fun part. Building out my animal detail view by binding all the animal detail attributes in my mock data to the view.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;main class="animal-wrapper"&amp;gt;
  &amp;amp;lt;h1&amp;gt;{{animal.name}}&amp;amp;lt;/h1&amp;gt;
  &amp;amp;lt;h3&amp;gt;{{animal.type}}&amp;amp;lt;/h3&amp;gt;
  &amp;amp;lt;p&amp;gt;{{animal.description}}&amp;amp;lt;/p&amp;gt;

  &amp;amp;lt;h5 *ngFor="let foodItem of animal.food"&amp;gt;{{foodItem.name}}&amp;amp;lt;/h5&amp;gt;

  &amp;amp;lt;h5 *ngFor="let habitat of animal.habitats"&amp;gt;{{location.name}}&amp;amp;lt;/h5&amp;gt;

    ...

&amp;amp;lt;/main&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Once I've got the attributes and properties from my mock service in place I'm ready to test my prototype. &lt;/p&gt;

&lt;h2&gt;
  
  
  To Wrap Up
&lt;/h2&gt;

&lt;p&gt;In this series I walked through how I take my designs from clickable prototypes into full code prototypes. This has helped my clients and projects immerse themselves in the final experience quicker. We are able to get this into someones hands much quicker than full development and test out some of the more difficult to prototype experiences. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>design</category>
    </item>
    <item>
      <title>Make mock data for your detail view component </title>
      <dc:creator>Michaela Hoffman</dc:creator>
      <pubDate>Thu, 01 Jul 2021 16:36:26 +0000</pubDate>
      <link>https://dev.to/michaelahoffman/make-mock-data-for-your-detail-view-component-59dp</link>
      <guid>https://dev.to/michaelahoffman/make-mock-data-for-your-detail-view-component-59dp</guid>
      <description>&lt;p&gt;In this part of the series I'm going to work on making the mock data for the detail view. In the previous part of the series I made the list view of the zoo animals. I need to now make the animal detail view.&lt;/p&gt;

&lt;h2&gt;How do I use this at work?&lt;/h2&gt;

&lt;p&gt;Much like in the first tutorial I use this to help create a clickable prototype directly in the code base. This allows our users and SMEs to see the new features and flows directly in the context of the website they are currently familiar with. &lt;/p&gt;

&lt;p&gt;This works really well when you are working to fold a new user experience into an existing system. &lt;/p&gt;

&lt;p&gt;This also works great for new systems when I’m helping businesses transition from keeping their data and business processes in an excel spreadsheet to an application with business intelligence. I usually do a prototype like this after first testing assumptions with paper prototyping and a prototype in a tool like Figma or Sketch. &lt;/p&gt;

&lt;p&gt;Moving the prototype further into actual code allows you to create a testing experience that closely mimics the real working software complete with complicated user interactions and mock data. &lt;/p&gt;

&lt;h2&gt;Animal Detail View&lt;/h2&gt;

&lt;p&gt;First I'll create a new component to hold all the details about the animal.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;ng g c zoo-animals/animal&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;In this new component I'm going to return data from the data set for the specific animal that is clicked on from the list component. &lt;/p&gt;

&lt;p&gt;Before I set up returning information when you click to an animal from the list I'm going to need to set up my mock interface data. &lt;/p&gt;

&lt;p&gt;I'm going to create a new animal interface in this animal.component.ts file and in this data set add a lot more attributes and data types about the 3 animals in addition to the first data set that is currently serving up the list view.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export interface IAnimal {
  guid: string;
  name: string;
  type: string;
  description: string;
  numberAtZoo: number;
  photo: string;
  animalInResidence: IAnimalInResidence[];
  food: IFood[];
  habitats: IHabitat[];
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As I was working through the details of the animal attributes I wanted to include I some information on each individual animal in residence. I also wanted to include an array of food and the habitats the animal lives in so that I can use the individual information in interesting ways later in my application rather than relying on a string for everything. &lt;/p&gt;

&lt;p&gt;No next I needed to export interfaces for the individual animals, food, and habitats. &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export interface IAnimalInResidence {
    name: string;
    personality: string;
    age: number;
}

export interface IFood {
  name: string;
}

export interface IHabitat {
  name: string;
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The next thing I need to do is to create new export classes for each animal in your list of zoo animals. Again one for each of our animals in the list: shark, giraffe, &amp;amp; capybara. &lt;/p&gt;

&lt;p&gt;Below is my export class for Animal 3, the capybaras.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;export class Animal3 implements IAnimal {
  guid = 'fed513f5-af68-43d0-ac6f-fe5e15309f91';
  name = 'Capybara';
  type = 'Mammal';
  description = 'Capybaras has a barrel-shaped body with a short head and reddish-brown fur.';
  numberAtZoo = 4;
  photo = 'asset/capybaraexamplephoto.jpg';
  animalInResidence = [
    {
      name: 'Getty',
      personality: 'She loves to chew on her water plants at the edge of the water. ',
      age: 2
    },
    {
      name: 'Pontoon', 
      personality: ' Pontoon is very shy but loves to get chatty with Getty!',
      age: 5
    }
  ];
  food = [
    {name: 'grass'},
    {name: 'water plants'}
  ];
  habitats = [
    {name: 'rivers'},
    {name: 'marshes'}
  ]
}&lt;/code&gt;&lt;/pre&gt;

&lt;h2&gt;The Problem&lt;/h2&gt;

&lt;p&gt;Do you see the problem already? &lt;/p&gt;

&lt;p&gt;I am currently creating two animal interfaces used in two different components based on the same animal. Currently I don’t have a way to pull the right animal’s data into the UI at this point. I want to avoid reaching into the zoo-animal.component.ts file to grab the mock data that lives there.  It would be really messy and hard to maintain if I went down that path. As well as, when the time comes for me or another developer to strip out the mock data and replace it. &lt;/p&gt;

&lt;p&gt;I need to get those interfaces combined and out into their own file.&lt;/p&gt;

&lt;h2&gt;To wrap up&lt;/h2&gt;

&lt;p&gt;I've now created two sets of the same classes. I have different data in both places but this isn't really the way I want it to be. I want to get to the point where I have one set of data to "rule them all". Which can be reused all over my application. &lt;/p&gt;

&lt;p&gt;In the next post I'm going to be working through moving all these pieces into a Mock Service so that I can create animals once and simplify the data set. &lt;/p&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>design</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Making Mock Data for an Angular list view component </title>
      <dc:creator>Michaela Hoffman</dc:creator>
      <pubDate>Thu, 17 Jun 2021 23:02:59 +0000</pubDate>
      <link>https://dev.to/michaelahoffman/making-mock-data-for-an-angular-list-view-component-41op</link>
      <guid>https://dev.to/michaelahoffman/making-mock-data-for-an-angular-list-view-component-41op</guid>
      <description>&lt;p&gt;In this tutorial, I’m going to start the process of making a prototype using mock data. My goal at the end of the series is to have quickly mocked data for a prototype while binding it to the UI. As a result, the data can be used across the app and there is only one point of maintenance. &lt;/p&gt;

&lt;p&gt;When I’m done with the series, I will have one data set that I can use to create demo components of my application.&lt;/p&gt;

&lt;h2&gt;
  
  
  How I use this process
&lt;/h2&gt;

&lt;p&gt;If you are a front-end developer or designer who codes and working without the back-end API for a proof of concept or prototype in the browser, this is for you. In order to complete this tutorial, you’ll need to have a good understanding of HTML. And how to start an Angular application.&lt;/p&gt;

&lt;p&gt;The skills in this series allow you to create demo content in your prototype. This is really useful for other teams within your organization that need to see real world data. You can also use it to make final design adjustments based on real data.&lt;/p&gt;

&lt;p&gt;Often in my role as a designer &amp;amp; developer I am working way early in the process. I don’t have an active API that I can pull from or back-end developer resources to build one. As a result, I need to stub or mock up my data set so that the interfaces I create look real and you can see data changing but without the help of a back-end dev.&lt;/p&gt;

&lt;p&gt;For this tutorial, I’m going to be making a zoo animal list view.&lt;/p&gt;

&lt;h2&gt;
  
  
  Animal List View
&lt;/h2&gt;

&lt;p&gt;Starting with an angular project create a new component, use ng g c zoo-animals in the terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;ng&lt;/span&gt; &lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="nx"&gt;zoo&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;animals&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I’m are going to start by creating the UI for each component. Then once I have the mock data set I will move it out to be used in a more generic way across the app. &lt;/p&gt;

&lt;p&gt;I go to the zoo-animails.component.ts file and export an interface of IAnimal so I can start building your data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IAnimal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Data will go here&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Because I’m thinking about my animal with the context of being on the list view that’s the data I’m going to be most concerned with for this part of the series.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;IAnimal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;guid&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nl"&gt;description&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;numberAtZoo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;number&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nl"&gt;photo&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Ah, there that looks good, pretty straight forward. I’ve got a solid list of attributes that will appear in my list and identify the animals to the users.&lt;/p&gt;

&lt;p&gt;I’ve defined in my interface that my classes are going to conform to this structure.&lt;/p&gt;

&lt;p&gt;Next I export classes for each animal you want in my mock data. Then I fill in the class with the data conforming to the interface.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Animal1&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;IAnimal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;guid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;f6c8fc66-9336-4bff-a492-416b5a165c58&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Giraffe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Mammal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Giraffes are tall with long necks and their coat has dark blotches or patches separated by light hair.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;numberAtZoo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nx"&gt;photo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;assest/giraffeexamplephoto.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Animal2&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;IAnimal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;guid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;6f248895-bba2-4a67-8a25-33d0894156c6&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Shark&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Fish&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Sharks come in all shapes and sizes. Sharks typically have sharp teeth, fins, and gills.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
  &lt;span class="nx"&gt;numberAtZoo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nx"&gt;photo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;asset/sharkexamplephoto.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;Animal3&lt;/span&gt; &lt;span class="kr"&gt;implements&lt;/span&gt; &lt;span class="nx"&gt;IAnimal&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;guid&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;fed513f5-af68-43d0-ac6f-fe5e15309f91&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Capybara&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Mammal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
  &lt;span class="nx"&gt;description&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Capybaras has a barrel-shaped body with a short head and reddish-brown fur.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;numberAtZoo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nx"&gt;photo&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;asset/capybaraexamplephoto.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Animal Data for the List
&lt;/h2&gt;

&lt;p&gt;Once I’ve got my data for 3 different animals ready to go I want to pull those into a list in the zoo-animals UI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt; &lt;span class="nx"&gt;animals&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;IAnimal&lt;/span&gt;&lt;span class="p"&gt;[]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Animal1&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Animal2&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
    &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nx"&gt;Animal3&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="p"&gt;];&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For this view I prepared a property of animals that conforms to the animal interface from earlier. Notice I typed the IAnimal interface with the array syntax [ ]. This sets up our property to know that its going to take a list of instances of our animal classes.&lt;/p&gt;

&lt;p&gt;Then I new up the three instances of our animal classes that I created above inside the array. Makes sense right, I want to create a list of animals so let’s give the interface an array!&lt;/p&gt;

&lt;p&gt;Open your zoo-animals.component.html. For this project I’m using an Angular Material theme just for fun.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;table&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;dataSource&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;animals&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mat-elevation-z8&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ng&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="nx"&gt;matColumnDef&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;th&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;cell&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;matHeaderCellDef&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/th&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;td&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;cell&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;matCellDef&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;let animal&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="nx"&gt;animal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/td&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ng-container&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt;

    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;tr&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;matHeaderRowDef&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;displayedColumns&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/tr&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;tr&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;row&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;matRowDef&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;let row; columns: displayedColumns;&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/tr&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/table&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As a result you can see I created my first column in the above code. Then I added the animal name and the “…” represent the remaining columns.&lt;/p&gt;

&lt;p&gt;After that I needed to add the angular material way of defining the header and footer. Otherwise, you’ll get a nasty error. In the last two &lt;/p&gt;
&lt;tr&gt; tags I reference an array of table names that match the matColumnDefinition on my ZooAnimalsComponent.  

&lt;p&gt;To finish it out I displayed the rest of the data defined in the interface for a user to know what they are clicking on to get to the detail page. &lt;/p&gt;
&lt;h2&gt;
  
  
  Link to the Correct Animal Detail View
&lt;/h2&gt;

&lt;p&gt;Before I move on from this component I need to set up our link into the detail view.&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ng&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;container&lt;/span&gt; &lt;span class="nx"&gt;matColumnDef&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;name&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;th&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;header&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;cell&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;matHeaderCellDef&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;Name&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/th&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;td&lt;/span&gt; &lt;span class="nx"&gt;mat&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;cell&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt;&lt;span class="nx"&gt;matCellDef&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;let animal&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;routerLink&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;['/animals', animal.guid]&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt;&lt;span class="nx"&gt;animal&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;}}&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/a&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/td&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ng-container&amp;gt;&lt;/span&gt;&lt;span class="err"&gt; 
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;



&lt;p&gt;For this I’m adding a router link around my name column. I’m then planning on passing the following into the link. animals followed by the animal.guid property from each animal. Since I don’t have the animal component yet this doesn’t do anything but set us up for the next post in this series. In the next post, I will be diving into the detail view and all the mock data we will see there!&lt;/p&gt;

&lt;h2&gt;
  
  
  To wrap up
&lt;/h2&gt;

&lt;p&gt;The work I did above will set me up nicely for diving into the detail page. It gives me a good starting point for my mock data and getting it displayed to the screen.&lt;/p&gt;


&lt;/tr&gt;

</description>
      <category>angular</category>
      <category>typescript</category>
      <category>design</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
