- Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome.
- We have detected you are using Google Chrome and might be unable to use the Java plugin from this browser.
- You can use export statement to export the component class from a module and it is defined in a file named app.component.ts.
- Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
- Like we have some component class name, @component is a decorator and used to identify that it is a component.
In this post, we will understand the architecture of Angular 2 framework.
It can be defined as a block of code which is used to do some task. The application in angular can be defined as modules and there are different modules that can be used to build any application. You can get any value from the code like class in the module. Angular 2 provides component class which is basic building block and it is exported from a module.
this statement defines a module and its class named AppComponent as public class. so it is accessible to other modules also.
It can be defined like a controller class which contains a template. It is used for view of the app and logic. We can define some code that works as a function and can be used inside the application. You can also define css styles to a component.
@Component is used to register a component. One DOM element will have only one component.
template is used to define the view of any component. It shows how to display a component.
Like in the below template it displays name:
It tells how to process the class. That means it is used to identify something. Like we have some component class name, @component is a decorator and used to identify that it is a component.
Here selector,template and directives are decorators.
It connects the templates and the components.
These are the types of data binding:
Interpolation: It shows the value of component within html div tags.
Property Binding: parent to child property passes.
Event Binding: It is processed when component method name is clicked.
Two-way Binding: ngModel directive is used to bind property and event.
metadata is defined by a directive. These are the types of directives:
Component Directive: It is used as custom HTML element.
Decorator Directive: It decorates the elements.
Template Directive: It converts html into a template.
It is used in angular in order to use different components across the application by passing them as an object.