Angular
Angular
2. What is Angular?
Ans: - Angular is an open source, JavaScript front-end framework to build Client Side
Applications.
It is completely written in typescript.
It is developed in Single Page Applications.(sidebar tsach rahto to change hot nhi.)
mhnje page reload hot nhi.
It is maintained by Google.
It is designed for web, desktop, and mobile platforms.
i. Structural directives :- Structural directives are used to change the existing structure of an
html file.
By using the structural directives we can add the basic logical part into our html file.
Their are 3 structural directives
a. ngIf :-
b. ngFor :-
c. ngSwitch :-
ex. <h1 *ngIf="true"></h1>
ii. Custome Directives :- We can create our own directive which will add the functionality to
the element of html.(tumhala jsa pahije tsa directive tyar krn)
like the custom pipe we can create the custom directive.
By using the concept of custome directive the html elements gets updated based on
the logic.
ng generate directive directive_name:- 2 file genaret hotat .ts & .spec.ts and 1 file update
hoti hai app.module.ts
iii. Attribute Directives:- Attribute Directives listen to and modify the behaviour of other
Html elements, attribute, properties, and components.
Attribute directives are :-
a. NgClass:- Adds and remove a set of CSS classes.
b. NgStyle:- Adds and remove a set of HTML styles.
c. NgModel:- Adds two-way data binding to an HTML form element
9. What is Data Binding? How many ways in which it can be done? {{}}
Ans: - Data Binding in Angular allows us to communicate between a component class & its
corresponding View template. (mhnje aapn .ts file madhe class chya aata madhi variable
define krto aani to variable aapn html file madhe use krto. {{ data }}).
ii. Two Way Data Binding :- It's binds data from component class to view template & view
template to component class. This is a combination of property binding & event Binding. (It
is a Bidirectional) syntax is [(ngModel)]
11. What are the commands which are used to create component, Service,
Pipe and Directive?
Ans:- ng generate component component_name, ng generate service, ng generate pipe, ng
generate directive
13. What is the process called by which typescript code gets converted into
javascript code?
Ans:- Its Transpiling process.
14. Why typescript is used in Angular instead of javascript?
Ans:- TypeScript is more readable and maintainable than JavaScript.
TypeScript supports abstraction through interfaces, while JavaScript does not.
TypeScript supports both static and dynamic typing. Loosely typed. JavaScript
supports only dynamic typing.