From the course: Learning Polymer

Unlock the full course today

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

Declare properties and behavior

Declare properties and behavior - Polymer Tutorial

From the course: Learning Polymer

Start my 1-month free trial

Declare properties and behavior

- [Instructor] Okay, so we've seen how to build our custom elements structure and define it's appearance, so let's see now how to add logic to the component. Components can expose properties that customize their behavior and participate in data binding which we'll look at later in the course. Components can also handle events and define other internal logic using java script just as you would in a regular web page. So for example, we can define a property for our message banner element that controls whether it is visible in the page and we can have that property be connected to an attribute on the element in the HTML markup. We can also define a property that controls how the message banner appears to the user. For example, we can add a type attribute as you saw in the previous video that indicates the severity of the message being displayed. So to do this we'll need to define a couple of properties on the element. Properties can have a variety of associated information with them such…

Contents