From the course: Angular: Workflows

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Component implementation

Component implementation - Angular Tutorial

From the course: Angular: Workflows

Start my 1-month free trial

Component implementation

- [Instructor] With a bit of cleanup out of the way, we can now implement our component. A smart way to develop your own component is to start form the public interface. How do we want to use this component? Let me open up a new file here. You can expect to use the component like this. We have the component selector here. It will take in an input which is status and this'll be a property on a pairing component and then we have the closing tag. This is how we want to use our component. Let's define that input now in our component file. The input will be status which is of type string. We will then need a method that will return the color based on a status. Let's call this method status to color. It takes in an input, status, which is string. We can use a switch case here on the status for the case that is danger return red, case safe return green, status of warning return yellow, and if none match, let's just return green. We'll need a property to store the color and that is of type…

Contents