Build an Angular Component Controller Using ES6 Class

Lukas Ruebbelke
InstructorLukas Ruebbelke

Share this video with your friends

Send Tweet

The simplest version of a component in Angular 2 is nothing more than a container for a template. When we need to introduce imperative logic into our component, we do that via an ES6 class. We accomplish the exact same thing in Angular 1.x by using an ES6 class to serve as a controller for a component. In this lesson, we will examine an Angular 2 component to establish the pattern and then illustrate the similarity as we build out our own controller in ES6.

Fabio Bedini
Fabio Bedini
~ 5 years ago

Hi there, sorry to bother you but it would not be better to avoid the controllerAs syntax to not override the default $ctrl alias ?