Angular
Angular
ng new app-name
creates new a project
ng serve
compiles app code, starts server and deploys app at port
4200(default port)
angular.json > projects > app-name > architect > build > styles
NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
FormsModule
],
providers: [],
bootstrap: [AppComponent]
})
main.ts>AppModule.ts>Component.ts>index.html
Components
Data binding
Directives
services
Dependency injection
Data-Binding:
String interpolation {{}}
property binding [property]=variabale
two-way data binding [(ngModel)]=variabale
event binding (event)=action($event)
Directives:
*ngIf - structural directive
ng-template
[ngStyle]={style object}
[ngClass]={className:condition}
when using c9.io codeanywhere virtual ides use ng serve --host 0.0.0.0 --disable-
host-check to get output on required container url.
when importing a inbuilt module import it in app.module.ts and declare import in
imports array of NgModule directory
Service are edfined by using @Injectable() decorator.