Join Ray Villalobos for an in-depth discussion in this video Cleaning up components, part of Learn AngularJS 2: The Basics.
- View Offline
- [Voiceover] Our application is almost done,…but there is a couple of things that we could improve on.…Since we may end up using our artist class,…it would be a good idea to create that as a separate file.…Also, we're using our styles a little bit inconsistently.…In the app.component.ts, we're using a style URLs,…and in the artist item component, we're using…just a styles array with individual styles.…So let's go ahead and fix both of those.…Let's start with taking out this interface artist…from both of the places using it,…and separating that as a separate file.…
So I'm gonna cut this one out of here,…and then I'm going to create a new file here,…and I'll just call this artist.ts, and in here…I'm gonna paste that and make sure…that I use an export command,…otherwise I won't be able to import it somewhere else,…and then I'm going to save this,…come back over here, and import it manually.…Here we're just gonna grab this one,…and copy it, and import artist,…the class or the interface,…from just the artist class file that we just created,…
In these tutorials, Ray Villalobos shows you how to start using AngularJS 2 in your own projects. He starts by defining what exactly Angular 2 is and how it differs from AngularJS 1. Then, once the basics are out of the way, he sets up the template that will drive the project and starts coding. Ray shows how to divide your project into modules, work with events, style content with CSS, and create components and subcomponents. Plus, find out how to change content dynamically using data pipes.
The template is included as a free download for all members.
- What is AngularJS 2?
- Setting up our template
- Creating a simple component
- Using multiple modules
- Displaying data in our templates
- Working with events
- Creating a subcomponent
- Filtering content through data pipes