Instructor: We are starting with a fresh Angular CLI project, and all I prepared for you is a dummy data service, which has a method called getData, which returns an observable of a string array, which returns an array of those three names.
The next thing we want to do is creating a smart component which displays those names on the screen. For this, we can open up a terminal, and we can type ng generate component smart, which creates a new component for us.
Then, we can head over to that new component, and we can inject the dummy data service in the constructor, dummy-data-service, and in the ng on init, we can call this.dataservice.getData.
We can subscribe to that method. We can take the result as a parameter, which is of the type string array. Then, we will introduce a new property called data, which is also of the type string array. Inside the subscribe, we can say this.data=result.
If we now head over to the template of that smart component, we can do an ordered list and do some list items, tag it with the ng for directive, and say let item of data. We can bind to that newly-introduced variable item.
Last but not list, we have to go to our app component HTML, and we have to use that new smart component. If we save all that, you can see on the right-hand side, the names Phil, Mike, and Peter are rendered on the screen.
Here, we build up a smart component, because it knows where to get the data from, it gets injected the dummy data service, and displays the data in our template.