click below
click below
Normal Size Small Size show me how
Angular
Question | Answer |
---|---|
The basic building blocks of an Angular application are: | NgModules, which provide a compilation context for components, NgModules collect related code into functional sets. |
_____ define views | Components, which are sets of screen elements that Angular can choose among and modify according to your program logic and data. Every app has at least a root component. |
_____ use services | Components, which provide specific functionality not directly related to views. Service providers can be injected into components as dependencies, making your code modular, reusable, and efficient. |
Both components and services are simply classes, with _____ that mark their type and provide metadata that tells Angular how to use them. | decorators |
Metadata for a component class | Which associates it with a template that defines a view. A template combines ordinary HTML with Angular directives and binding markup that allow Angular to modify the HTML before rendering it for display. |
Metadata for a service class | Which provides the information Angular needs to make it available to components through Dependency Injection (DI). |
@Component + ? | The @Component decorator identifies the class immediately below it as a component, and provides the template and related component-specific metadata. |
What are Decorators? | Decorators are functions that modify JavaScript classes. Angular defines a number of such decorators that attach specific kinds of metadata to classes, so that it knows what those classes mean and how they should work. |
@Injectable + ? | A service class definition is immediately preceded by the @Injectable decorator. |
What does service class do? | For data or logic that is not associated with a specific view, and that you want to share across components, you create a service class. |
Router NgModule is a _____ | service |
What is NgModule | An NgModule is a container for a cohesive block of code dedicated to an application domain, a workflow, or a closely related set of capabilities. |
What does NgModule contains | It can contain components, service providers, and other code files whose scope is defined by the containing NgModule. |
Modules' importnat properties | delcarations(componeents, directives, pipes), exports, imports, providers(often specified at component level), bootstrap |
host view | When you create a component, it is associated directly with a single view, called the host view. The host view can be the root of a view hierarchy, which can contain embedded views, which are in turn the host views of other components. |
How to inject data in Angular | In Angular, you can inject data only via a constructor’s arguments. If you see a class with a no-argument constructor, it’s a guarantee that nothing is injected into this component. |