Angular Basics 5
Angular Basics 5
WebApplication Approaches
-------------------------
MPA vs SPA
------------
MPA-Multi Page Application
--------------------------
traditional way of developing web applications.
The web app which consists of multiple pages.
Evry time new content is displayed on a new fresh page
[full page refreshment]
But if UI is over complex---->page loading time will be more--->degrade user
experience
initially AJAX was used to develop SPA,but ajax added too much complex code to the
webpage
It added a lot of complexity
eg:-
Google,gmail,Facebook,Twitter,GitHub,Netflix,YouTube,etc
solution:-
developed using javascript frameworks like Angular,Cycle,Backbone,Vue
What is Angular
----------------
-Angular is a clientside framework used to develop SPA using HTML & Typescript
Angular Component
------------------
-Component is the basic building block of an Angular UI
-you can see the component[it is a visual element]
{{ }} is interpolation used to fetch value from ts file into the html file
hello.component.css
---------------------
h1{color:blue;font-size:25px;}
hello.component.ts
---------------------
@Component({
selector:'hello-comp',
templateUrl:'./hello.component.html',
styleUrls:['./hello.component.css']
})
export class HelloComp{
message:string="Hello from SEED!!";
}
index.html
--------------
<header-comp/>
<article-comp/>
<categories-comp/>
<comments-comp/>
<news-comp/>
<footer-comp/>
_________________________________________________________
Angular Module
---------------
-In ANgular,Module is a group of related components,directives,pipes & services
-Root module acts as an entry point & helps to assemble & link all parts of an
angular appln
app.module.ts
-------------
@NgModule{(
declarations:[AppComponent,HeaderComponent,
HelloComp,FooterComponent,ProductComponent,LoginComponent],
providers:[],
bootstrap:[AppComponent]
)}
export class AppMOdule{}
-we can also create our userdefined modules
___________________________________________________________
app.component.html
------------------
<header-comp></header-comp>
<login-comp></login-comp>
<footer-comp></footer-comp>
<hello-comp></hello-comp>
index.html
-----------
<app-comp></app-comp>
ProductComponent
BillComponent
CartComponent
CatalogComponent
HomeComponent which is the bootstrap component
___________________________________________________________