I've talked about energy container, but there's a related directive called Endi template since now
when I use a template, what I was talking about, the beer associated with each component, however,
and web development, a template is a weather concept.
It is a group of them elements that is expected to be reused along abuse and what provides the template
directive with this purpose so you can define some structure and reuse or repeated along abuse, in
fact.
And the template is the mechanism that Angolite uses internally when you want to repeat elements using
a loop with the default directive.
I want to show you how ended and Playbook's up an app component XHTML down to the bottom.
The first thing is to remove the last app.
Simple part of you that I'm not using now and then I want to focus in the components in particular.
Alata, you imagine now that you want to repeat this one element in different places with same title,
a message instead of repeating it several times, you can write it inside the template and this way
you will only need to repeat the template.
Let's do it.
I create the template.
And they move all this stuff inside the template, let me show you something before using the template
if to the browser and click play on some counter, it starts the countdown by the end.
Now, instead of the allowed, I get a Cancellara one.
Does the server say, let's say cannot raid property, show off on the end?
Of course, this is because I have more the apps in order to be inside the editing directive.
So right now this element does not exist and maybe you and the templates are not render themselves.
The only thing I have now is a template with this content, but this template has not been used anywhere
yet.
OK, now that this has been clarified, let me show you how to use a template.
Where you have to do is to create the template reference variable in order to use the template along
The View.
So I create this variable here with hash tag time and template.
Now I can use it in The View and guess how the best way is.
We're using an entry container.
So the container and to tell the container, it has to use a specific template.
I have to use the directive and IT template Adelaide and they send it to the variable time and template
that is the name of my template reference variable.
Now my template is been inserted here and in fact I can use it as many times as I want.
I told you, this is a template that I can reuse anyway, in my view.
OK, let's see the browser.
Everything seems fine.
I click play and then I wait to the countdown and I can see again the view so I can right.
Click on it and pick, inspect and I can see and the dumb maps and board view but also below I have
another simpler view.
And the third one.
And the fourth one.
So I have now four elements like this.
In fact, I can go to my card in app components and cancel like every one of those elements with console
log item in order to lock all of those items of type simple colour to be a component that I repeated.
We're using a template.
As you can see here in the council, here are all my simple words, we accompanists not only one, but
four of them.
So summing up, you can see hell, thanks to a template.
I have written this content all at once, but then I've been able to use it several times.
You can even go further and pass Parramatta's to your template by using context.
The context is defined by some left attributes and their internal variables.
Let me show you how in the template I can add a message attribute so inserted it will have a message
variable and they can create also a title.
So instead I will have a title buyable.
I can also define the name of the properties of the received context like for example, title.
What does this mean?
I can use inside here the title Buyable.
Assets are valuable, I have to use a property ending now, I'm saying that the title property of my
Elat islanded to the title variable I will receive from outside and I can do the same thing with methods
by the to the methods variable.
Of course, in order to provide those inputs and to pass some context to the energy container that is
using the template.
Let me show you how to do it with the first one.
This requires another directive that is called and it template, outlet context.
And instead here, I basically need to pass an object with the properties you have the outside like
title that can be game over.
Remember, they can use title because in the title I have specified, this will be associated with the
title Property of the Context.
However, I have not defined the property for message.
For those situations, I can use a property dollar implicit and here in the law implicit a right time.
And that that will be the message displayed by this salad.
OK, I say this and move to the so you can see in the console output all my bills.
However, the first one have a different method, same time around it and a different title game over.
And in fact if you start some countdown you can see the Earth with Gameover title and around that message
because the electron is the first one detected.
OK, let's summarize this video I presented the energy template directive that allows you to create
content fragments that you can repeat on your view.
Also, you have used the energy, content and energy template, other directives to repeat the previous
template several times and you're done.
Finally, you have learned how to receive and use variables in your template with the energy template
outlook, context directive.