angular js_1
v1:--
angular js:---
framework to build client side applications.
Part of the page reload asynchronously without reload full page
use for SPA(Page is not reloading)
modular approach
Reusable code
development quicker and easier:--inbuilt capability validation /routing
Unit testable
Google+Microsoft(typescript)
2010:--angular js
2016:angular v-2
................................................................................
v-2:--
prerequistis:--html,css,js,basic typescript[es15]
devloment environment:--node npm angular cli
check version:--node -v
angular cli:--
its command line interface for angular.it allows you Generate building blocks for your angular application.it makes development quicker and easier.
setup run module routes can be added by using cli.
install:--
npm install -g @angular/cli
specific version install:--
npm install -g @angular/cli@10.0.0ex..
you can install two version of angular by using nvm
:node version manager can be used..
ng version to check version.
new project:--ng new projectname
ng serve run the web page
architecture:--
module:--
user:--application of user
admin:admin module realated to admin
root module:--app
components:--one side bar one app[root component]
:-html/class included
module:--component&services&pips,interfaces
Group of functionality:--
user Auth:--
Login register ForgetPassword api call helpers
How to create module:--
Appmodule is the master...
ng generate module userAuth..
then multiple component can be created..
in app module add it
import {} from './user-auth/user-auth.module'
imports:[
userAuthModule
]
ng generate component user-auth/login
exports:[
LoginComponents
]
services:--business logic
modules interact and ultimately render the view in the browser.
package.json:-dependency and dev dependencies
src:--main.js entry file
app:--app.module
app.component
class:-appcompoent.ts&appcomponent.html
..........................................................................................
component:--
3 parts:
template:
view html
class:
code typescript/data&methods
metadata:
information
decorator:-
function that provides information about the class that attached to it
run:--index.html:--<app-root></app-root>[it replaced]
new component:--
ng g c nameofcomponent
as a tag used:--appcompoent.html:--<app-test></app-test>
ng serve
selector:--
selector:'.name'
<div class="app-test"></div>
selector:[]
<div app-test></div>
templateurl:-
template:'<div>inline template</div>'
......................................................................................
file and folder structure:--
package.json:
detail of the project [deleted so application will not run]
node_modules:-all library[angular]
src:--component:--app
assets:-extra css/images
environments:-building
index.html:-
main.js: its bootstrap[html and angular collect]:-angular app
style.css:-style
....................................
package.lock.json:-
detailed info of packages[if deleted so angular app will run]
angular.json:-
application configuartion
tsconfig.json:-
typescript info:
target area
browserlistrc:
browserlist info...
karma.config.ts:
testing file
...........................................
interpolation:--
to display dynamic data into html:{{ }}
can be shown property and function
angular cli:--
ng generate....no of commands .....
app component is root component...
>for creating component:-ng g c component name
>for creating component:-ng g m modulename:--no of component..like user>
ng g c modulename/component name
build:--ng build[dist/blog>that we put into server to run]
component:---building blocks for specific feature.
appmodule.ts:the component is added there...
72089 96417
for inline style:-
ng g c componentname --inline-style
template:--
ng g c componentname --inline-template
ng g c componentname --inline-template --inline-style
data binding:--one way data binding/two way data binding
Style binding:-----
[style.color]=" color"
.............................................................
function calling:----[event binding]
keyup:-----
keyup and keydown difference:---
same key if you press and same key not press......
keydown==input
blur event,mouseover,mouseleave
..............................................................................................................................
style.css:--for multiple component[as a global css]
inline css is same as html css
inline style has higher property
..............................................................................................................................
Data binding:---
component===view communication
ts[component]-------html[view]
two ways:
One Way Data Binding:--
Ts:---->HTml/Html--->Ts
1.string interpolation{{}}
2property binding [property]='data'
[class]="value"
jis bhi property m value pass karne h put into [] bracket
Html<---->Ts
[(ngModel)]='data'
propertybinding:====
[name]=value{with the properties}
3...using signal[angular 17 added]
.......................................................................
ngif:---
...ngif else
ngswitch:--
.......................................................................
ngfor:---
htmlfile:
nested for:
.........
style binding
...................
nested style binding
...........................
Formmodule:--
in module we have to import:--
two types:
Template driven form
Reactive form
Template driven form validation:--
......
Reactive Form:------
app.Module.ts
component.ts:
Form Group:handles the complete from.
Form Control:-specifically handle the specific field.
html:
validation react form:----
ts file:-
getter method-
angular life cycle hooks:--
new component created:-instantiated:--
when <app-><app->
constructor:---ngOnChanges[new component bind input property change()]
ngOnInit:---[]
ngDoCheck:--change detected
ngAfterContentInit:--
ngAfterContentChecked:
ngAfterViewInit
ngAfterViewChecked:
ngOnDestroy

Comments
Post a Comment