Angular Interview Questions and Answers Set 7
61.Explain the process about angular project bootstrap?
Bootstrap is a function component in the core ng module that is used for starting up the Angular application manually, which gives more control over how to initialize the application.
62.What are different type or classification of directives?
AngularJS directives can be classified in 4 different types:-
Element directives:
<ng-directive></ng-directive>
Attribute directives:
<span ng-directive></span>
CSS class directives:
<span class=”ng-directive: expression;”></span>
Comment directives:
<!– directive: ng-directive expression –>
63.What is transclusion in Angular?
Transclusion is a very powerful and useful feature of AngularJS directives which allows a directive to use a template while still having the ability to clone the original content and add it to the DOM. Transclusion allows directives to generate dynamic, data-driven DOM structures that create a compelling user experience.
64.What is the name of directive is used to bootstrap an angular app?
ng-app directive is used to auto-bootstrap an AngularJS application. The ng-app directive defines the root element of the application and is typically present in the root element of the page.
E.g: on the <body> or <html> tags.
65.In how many different ways, you can define a directive and what is the best practice?
Angular generally prefers camelCase for directives. But since HTML is not case-sensitive so it refers to directive in DOM in lowercase form, delimited by dash (eg. ng-app). But when Angular complies then it normalize the directives.
Below are example of valid directive declaration:-
ng-model
ngModel
ng:model
ng_model
data-ng-model
x-ng-model
ANGULAR TRAINING
Weekend / Weekday Batch
66.What are events in Angular?
In Angular , event binding is used to handle the events raised by the user actions like button click, mouse movement, keystrokes, etc. When the DOM event happens at an element (e.g. click, keydown, keyup), it calls the specified method in the particular component.
67. What do you mean by String Interpolation?
string interpolation is the process of evaluating a string literal that contains one or more placeholders. It yields a result in which the placeholders are replaced with their values.String interpolation in Angular is used to display dynamic data on an HTML template.
68. What do you mean by string interpolation?
String interpolation in Angular, also known as the mustache syntax, only allows one-way data binding. It is a special syntax that makes use of double curly braces {{}} so that it can display the component data. Inside the braces are the JavaScript expressions that Angular needs to execute to retrieve the result, which can further be inserted into the HTML code. Moreover, as part of the digest cycle, these expressions are regularly updated and stored.
69.What is Buffer (window storage)?
A buffer is like a cache that is a data area of computer memory (RAM) reserved for temporary storage. For example, when you press several keys in quick succession on the keyboard, the commands are stored momentarily in a buffer, allowing the computer to process them in the correct order.
70.How do we include css file ins. the component except using styleUrls property?
Angular components can be styled via global CSS the same as any other element in your application. Simply drop a “ element on the page. However, Angular additional gives developers more options for scoping the styles.