JavaScriptLA
Slides.com website for JavaScriptLA -- use this place to find our meetup group presentations. Want more? Visit our website at: https://www.javascriptla.net to get on our mailing list.
Deep Dive Into The Framework
Vijay Menon, Organizer
Angular is a JavaScript framework that:
Angular is currently in version 8, and documentation is available at https://www.angular.io
vs something else (e.g. React, Vue, JQuery, Wordpress)?
$ npm install -g @angular/cli
Here's how to get the latest CLI from Angular on your computer
Make sure you have Node Version 8.9 or HIGHER!
$ ng new myProject
$ cd myProject
$ ng serve --open
Starts downloading and creating all the files and folders you need to run Angular out of the box. After running ng serve, you should see your browser open to this project folder's start page.
Visit https://www.angular.io
Try saying all of the above 5x fast!
$ npm install -g typescript
$ touch myTypeScript.ts
$ echo "console.log('Hello World');" > myTypeScript.ts
$ tsc myTypeScript.ts
$ node myTypeScript.js
Interested in more on TypeScript?
Check out my blog post at:
/* These are JavaScript import statements. Angular doesn’t know anything about these. */
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
/* The @NgModule decorator lets Angular know that this is an NgModule. */
@NgModule({
declarations: [
AppComponent
],
imports: [ /* These are NgModule imports. */
BrowserModule
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
import { Component } from '@angular/core';
import { products } from '../products';
@Component({
selector: 'app-product-list',
templateUrl: './product-list.component.html',
styleUrls: ['./product-list.component.css']
})
export class ProductListComponent {
products = products;
share() {
window.alert('The product has been shared!');
}
hello() {
window.alert("A failed economy");
}
onNotify(){
window.alert('You will be notified when the product goes on sale!');
}
}
/*
Copyright Google LLC. All Rights Reserved.
Use of this source code is governed by an MIT-style license that
can be found in the LICENSE file at http://angular.io/license
*/
component.ts file
product-list.component.ts
<h2>Products</h2>
<div *ngFor="let product of products; index as productId">
<h3>
<a [title]="product.name + ' details'" [routerLink]="['/products', productId]">
{{ product.name }}
</a>
</h3>
...
component.html file (template)
product-alerts.component.html
button {
background: rgb(245, 91, 186);
}
component.css file
product-alerts.component.css
Directive Type | Example | Use |
---|---|---|
Structural | *ngIf="hero.name" | Hide / Show el |
Attribute | [(ngModel)]="hero.name" | two way binding on a compoent property |
Pipe | <p>Today is {{today | date }}</p> |
Format today to the date |
export class HeroListComponent implements OnInit {
heroes: Hero[];
selectedHero: Hero;
constructor(private service: HeroService) { }
ngOnInit() {
this.heroes = this.service.getHeroes();
}
selectHero(hero: Hero) { this.selectedHero = hero; }
}
Implement a Service in a component
rxjs and Observables are a course in themselves!
Movie App
Search Bar
MovieList
MovieListing
Check out my video course via https://www.hackbudy.com.
You'll get over 8 hours of video training, plus:
Act NOW! Use code SUMMER-PREVIEW to save 70% - after August ends, deal is gone!
Support the group, get a T-shirt (or books, videos)!
Visit https://javascriptla.net and click "Shop"
Get on the mailing list at: https://javascriptla.net
By JavaScriptLA
Slides.com website for JavaScriptLA -- use this place to find our meetup group presentations. Want more? Visit our website at: https://www.javascriptla.net to get on our mailing list.