(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
| private int[,] grid; | |
| public static int DEAD_CELL = 0; | |
| public static int LIVING_CELL = 1; | |
| private int rowCount; | |
| private int columnCount; | |
| public GameOfLife(int rowCount, int columnCount) | |
| { | |
| grid = new int[rowCount, columnCount]; | |
| this.rowCount = grid.GetLength(0); |
| https://keathmilligan.net/lazy-loading-content-with-angular-cli/ |
| # Create Branch | |
| git checkout feature_branch | |
| # Merge Master into my feature branch | |
| git merge master | |
| # Add all files and commit them | |
| git add -A | |
| git commit |
| You don't need to use [attr.selected]. | |
| [(ngModel)]="user.role" is two-way data-binding, | |
| it will select the matched option from your list if value is equal to user.role. And you can also use basic [value] | |
| <select name="role" [(ngModel)]="user.role"> | |
| <option *ngFor="let role of roles" [value]="role">{{role.name}}</option> | |
| </select> |
| If you don't need two-way data-binding: | |
| <select (change)="onChange($event.target.value)"> | |
| <option *ngFor="let i of devices">{{i}}</option> | |
| </select> | |
| onChange(deviceValue) { | |
| console.log(deviceValue); | |
| } | |
| For two-way data-binding, separate the event and property bindings: |
| <!-- | |
| Sometimes, we don’t need a FormGroup, as our form might only consist of a single form control. Think of a search field that let’s you search for products in an e-commerce application. Technically, we don’t even need a <form> element for that. | |
| Angular comes with a directive formControl which doesn’t have to be inside a formGroup. We can simply add it to a single form control and are ready to go: | |
| --> | |
| <!-- no surrounding form --> | |
| <input type="search" [formControl]="seachControl"> | |
| <!-- | |
| The cool thing about form controls in Angular is, |
| /* | |
| JavaScript classes are introduced in ECMAScript 6 and are syntactical sugar over JavaScript's existing prototype-based inheritance. | |
| The class syntax is not introducing a new object-oriented inheritance model to JavaScript. JavaScript classes provide a much simpler and clearer | |
| syntax to create objects and deal with inheritance. | |
| */ | |
| var Users = class { | |
| constructor(fullName, description) { | |
| this.fullName = fullName; | |
| this.description = description; |
| var users = []; | |
| users['john'] = { id: 'john01', role: 'admin' }; | |
| users['bob'] = { id: 'bob01', role: 'reader' }; | |
| console.log(users); | |
| console.log(users['bob']); | |
| console.log(Object.keys(users).length) | |
| /* |
| var users = {} | |
| users = { | |
| "john": { id: 'john01', role: 'admin' }, | |
| "bob": { id: 'bob01', role: 'reader' }, | |
| } | |
| users["steeve"] = { id: 'steeve01', role: 'admin' }; | |
| console.log(users); | |
| console.log(users['bob']); |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.