Tutorial by Examples: comp

hero.component.html <form (ngSubmit)="submit($event)" [formGroup]="form" novalidate> <input type="text" formControlName="name" /> <button type="submit">Show hero name</button> </form> hero.component.ts import...
Components will render in their respective selector, so you can use that to nest components. If you have a component that shows a message: import { Component, Input } from '@angular/core'; @Component({ selector: 'app-required', template: `{{name}} is required.` }) export class RequiredC...
C++ & Java are both object-oriented languages, thus the following diagram applies to both.
data.service.ts: import { Injectable } from '@angular/core'; import { Http } from '@angular/http'; import 'rxjs/add/operator/map'; @Injectable() export class DataService { constructor(private http: Http) { } fetchData(){ return this.http.get('https://dinstruct-d4b62.firebaseio....
This example requires FormsModule and ReactiveFormsModule. Please import them in your application/module. import {FormsModule, ReactiveFormsModule} from '@angular/forms'; input-form-example.html <form class="example-form" (ngSubmit)="submit(addForm.value)" [formGroup]=&qu...
This example requires FormsModule and ReactiveFormsModule. Please import them in your application/module. import {FormsModule, ReactiveFormsModule} from '@angular/forms'; autocomplete-overview-example.html: <md-input-container> <input mdInput placeholder="State" [mdAutocom...
Project build.gradle allprojects { repositories { jcenter() // Add this if you use Gradle 4.0+ google() // Add this if you use Gradle < 4.0 maven { url 'https://maven.google.com' } } } ext { archVersion = '1.0.0-alpha5' } Applic...
Extend your activity from this activity public abstract class BaseCompatLifecycleActivity extends AppCompatActivity implements LifecycleRegistryOwner { // We need this class, because LifecycleActivity extends FragmentActivity not AppCompatActivity @NonNull private final LifecycleRe...
Each UI component lifecycle changed as shown at image. You may create component, that will be notified on lifecycle state change: public class MyLocationListener implements LifecycleObserver { private boolean enabled = false; private Lifecycle lifecycle; public MyLocationListener(...
Sometime you will need to know, with 2 dates objects, if there are corresponding to the same date, or find which date is after the other. In Go, there is 4 way to compare dates: date1 == date2, returns true when the 2 are the same moment date1 != date2, returns true when the 2 are different mom...
Data item is stored in packed decimal format in COMP-3. Packed-decimal format means that each byte of storage (except for the low order byte) can contain two decimal numbers. The low-order byte contains one digit in the leftmost portion and the sign (positive or negative) in the rightmost portion. ...
This example requires MdDialogRef and MD_DIALOG_DATA. Please import them in the component module. import {MdDialog, MdDialogRef, MD_DIALOG_DATA} from '@angular/material'; input-overview-example.html: <md-input-container> <input mdInput [(ngModel)]="id" ...
First of all, we will need to create our Dockerfile. A good example can be found on this blog by Nick Janetakis. This code contains the script that will be executed on our docker machine at the moment of start.For this reason, we are installing all the required libraries and ends with the start of ...
In the example below, the calculateShippingPrice method calculates shipping cost, which takes some processing time. In a real world example, this would e.g. be contacting another server which returns the price based on the weight of the product and the shipping method. By modeling this in an async ...
mView.afterMeasured { // inside this block the view is completely drawn // you can get view's height/width, it.height / it.width } Under the hood inline fun View.afterMeasured(crossinline f: View.() -> Unit) { viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlob...
--from * Email From: --[no-]to * Email To: --[no-]cc * Email Cc: --[no-]bcc * Email Bcc: --subject * Email "Subject:" --in-reply-to * Email "In-Reply-To:" --[no-]xmailer ...

Page 34 of 34