Mobile Programming Ionic Angular
Mobile Programming Ionic Angular
angular
• Git bash Shell on windows
• Visual studio code editor , extension angular, angular script, tslint
• Node js get npm
• From git bash , using npm install angular
• If you have installed, check user system environment. User variables
C:\Users\SBW\AppData\Roaming\npm
System variables
C:\Program Files\nodejs\
Link
https://cli.angular.io/
Click documentation
Create project
ng new myProject
ng new yourname01
• e2e : end to end
cd yourprojectname
• ng serve –o
open http://localhost:4200/
Angular File Structure
https://angular.io/guide/file-structure
• Src/main.ts
• import { AppModule } from './app/app.module';
• Meaning : src/app/app.module.ts
• Index.html
• <body>
• <app-root></app-root>
• </body>
New Components
Create directory src/app/yourname
Under this directory create files :
yourname.component.html
yourname.component.ts
Yourname.component.ts
• import { Component } from '@angular/core';
•
@Component({
• selector: 'app-yourname',
• templateUrl: './yourname.component.html'
• })
• export class YournameComponent {}
app.module.ts
ADD
• import { PersonsComponent } from './yourname/yourname.compone
nt';
………..
declarations: [AppComponent, YournameComponent],
yourname.component.html
• <ul>
• <li *ngFor="let person of personList">{{ person }}</li>
• </ul>
app.component.html
<app-persons [personList]="persons"></app-persons>
User Input
person-input.component.ts
note : change person to yourname