Visual Studio

You might also like

Download as xlsx, pdf, or txt
Download as xlsx, pdf, or txt
You are on page 1of 14

Angular

1
https://coursetro.com/posts/code/174/Angular-8-Tutorial-&-Crash-Course
First select the folder form MENU

ANGULAR 8

Folder Structure
outline the important files and folders that you will commonly work

In HTML 5 and remain we save css file as style.css but in angular we save as Style.scss

Components
fundamental building blocks of your Angular app are the components.
Components consist of 3 elements

The imports
yekada nunchi import chesukuntam
@Angularcore
The component decorator
component decorator includes and
locations to your component's template
CSS location

The component logic


where your code resides.
two important areas that are specific to Angular 8 here are:

routerLink - how you link together different pages of your app. You don't use href.

router-outlet - This is where routed components are displayed within the template.

Routing
Angular CLI to generate a couple components for the pages in our app

Go to CMD enter >cd my-app


then we enter

This will generate several files for each component

In App.module.ts these components are generate


then we go to App.module.ts

Before that we add Homecomponent and listcomponent here show below .these are like our menu given HOME , LIST
(Home application separate component and list app has separate components .., its like separate page)

This are Routes

If you click on the List and Home links in the navigation, they will now display the component template associated with the clic

One way data binding


When you want to communicate data from the component logic to the template (or vice versa),
home.component.html

whatever we given in CLICK , COUNTCLICK that will given Property as typescript as home.component.ts

We've defined the property (with TypeScript) and we've set it to 0.

ng-template
What about working with if and else within your templates? We can use ng-template for that.

home.component.html:
Style Binding
Sometimes, you want to modify the appearance of your UI based on events that occur in your app

Ex:- if clicked 4 times its gray , but more then 5 times it changes to yellow, its style binding

What if you wanted to specify multiple CSS properties?

We can also set multiple classes with ngClass.


new project

Run the server


> > ng serve -ong serve -o
In Angular we don’t use href instead we use ROUTERLINK

(which we given in title ,that are components)

menu given HOME , LIST


See here we create home & list components then HOME & LIST create separate compoents

template associated with the clicked component!


arate compoents
virtual screen code view big (Crlt + B)

You might also like