05 2017 档案
摘要:Every movie needs a director and every rented movie needs to exist in the store. How do we make sure something in another table exists before insertin
阅读全文
摘要:Let’s say we have a bank. Our bank wants to give each account for each user a unique name, for instance, “Personal” or “Checking.” How can we make sur
阅读全文
摘要:.share() is an alias for .publish().refCount(). So if the source is not yet completed, no matter how many subscribers subscribe to the source, they sh
阅读全文
摘要:Eventually you will feel the need for pausing the observation of an Observable and resuming it later. In this lesson we will learn about use cases whe
阅读全文
摘要:This lesson will highlight the true purpose of the zip operator, and how uncommon its use cases are. In its place, we will learn how to use the combin
阅读全文
摘要:Manually unsubscribing from subscriptions is safe, but tedious and error-prone. This lesson will teach us about the takeUntil operator and its utility
阅读全文
摘要:The use of RxJS Subjects is common, but not without problems. In this lesson we will see how they can be usually safely replaced with plain Observable
阅读全文
摘要:The 2xx family of status codes are used in HTTP responses to indicate success. Beyond the generic 200 OK status code, there are a set of more specific
阅读全文
摘要:In this lesson we'll create a Higher Order Component (HOC) that takes care of the key property that React looks for when using map to create elements
阅读全文
摘要:Lookup types, introduced in TypeScript 2.1, allow us to dynamically create types based on the property keys of an object. We'll use the function spyOn
阅读全文
摘要:Let's say you are builing a reuseable component. The style structure like this: If you want to style this input field, it can be quite easy, we can ju
阅读全文
摘要:Let's look at several HTTP requests to learn the basic structure of these messages, and how the various elements communicate important information fro
阅读全文
摘要:Using it:
阅读全文
摘要:Writing SCSS @functions is similar to writing functions in other programming languages; they can accept arguments and have return statements. SCSS pro
阅读全文
摘要:The SCSS @for directive is great when we know how many iterations are required and we only need 1 variable. What if we need multiple variables to iter
阅读全文
摘要:In this lesson we'll use a simple GraphQL IDL schema to deploy and explore a fully functional GraphQL service in minutes with graphql-up. Install: Cre
阅读全文
摘要:Array: 1. slice() 2. concat 3. spread opreator: 4. Array.from: Object: Shadow copy: 1. object.assign: 2. spread opreator: Deep copy: From lodash: From
阅读全文
摘要:Learn how to use the 'withPropsOnChange' higher order component to help ensure that expensive prop computations are only executed when necessary. Simp
阅读全文
摘要:Learn how to user the ‘componentFromProp’ helper and ‘defaultProps’ higher order component to swap the underlying html tag of your component. Sometime
阅读全文
摘要:Learn how to use the ‘branch’ and ‘renderNothing’ higher-ordercomponents to render nothing when a certain prop condition ismet. Sometimes you only wan
阅读全文
摘要:Learn how to use the ‘branch’ and ‘renderComponent’ higher-order components to show errors or messaging when your component is in a non-optimal state.
阅读全文
摘要:Learn how to use the 'branch' and 'renderComponent' higher-order components to show a spinner while a component loads.
阅读全文
摘要:Learn how to use the ‘flattenProp’ higher order component to take a single object prop and spread each of its fields out as a prop. For example,we hav
阅读全文
摘要:Learn how to use the ‘withProps’ higher order component to pre-fill a prop, unable to be overridden. withProps, take string as arguement for creating
阅读全文
摘要:Learn how to use the 'mapProps' higher-order component to modify an existing component’s API (its props). 'mapProps' takes incoming props and changes
阅读全文
摘要:Learn how to use the 'lifecycle' higher-order component to conveniently use hooks without using a class component.
阅读全文
摘要:Learn how to use the 'withReducer' higher order component using the alternative reducer form. If you like using reducers in redux, you’ll be able to r
阅读全文
摘要:Learn how to use the 'withState' and 'withHandlers' higher order components to easily add local state to—and create a reusable local state pattern for
阅读全文
摘要:NgZone, Angular uses it to profiling all the async actions such as setTimeout, http request and animation. For example if you dealing with heavy oprat
阅读全文
摘要:Tachyons provides extensions (-ns, -m, and -l) to many of its classes to help you design for responsive layouts. This lesson walks you through designi
阅读全文
摘要:You probably have seen 'foorRoot()' method a lot inside Angular application. Creating a configurable NgModule allows us do the configuration for each
阅读全文
摘要:Unlike 'useClass', 'useExisting' doesn't create a new instance when you register your service inside ngmodule. 'useExisting' also can limit the functi
阅读全文
摘要:Using factory provider: Here we create 'DrinkFactory' as a named funciton, this is good for AOT, so recommended doing this way.
阅读全文
摘要:Previously we have 'OpaqueToken', but it is DEPRECATED. The new one is called 'InjectionToken'. The difference between OpaqueToken is for InjectionTok
阅读全文
摘要:directive: test:
阅读全文
摘要:For example, when testing container component we might import lots of children components, but we didn't actually testing those children components. S
阅读全文
摘要:The main idea for testing contianer component is to make sure it setup everythings correctlly. Call the onInit() lifecycle first, then the variables h
阅读全文
摘要:Component: Test:
阅读全文
摘要:Using pseudo-elements like ::before and ::after we can draw some simple icons without having using image assets which can help reduce the number of re
阅读全文
摘要:A solid naming convention makes it less likely to run into naming conflicts and helps establish a semantic pattern that is easier for a team to follow
阅读全文
摘要:Component: Test @Input & @Output:
阅读全文
摘要:Writing similar classes with minor variations, like utility classes, can be a pain to write and update. Sometimes just a single character is the only
阅读全文
摘要:Great improvements and optimizations can be made to the output of bundled code. Prepack provides the ability to optimize code at build-time, producing
阅读全文
摘要:Somtime 'async await' can have a bad effect on code proferemence. Let's take a look the below example: In the example, we are doing two await operatio
阅读全文
摘要:This lesson shows how regular control flow statements such as try/catch blocks can be used to properly handle errors in asynchronous functions. Oftent
阅读全文
摘要:Any function can be made asynchronous, including function expressions, arrow functions, and methods. This lesson shows the syntax for each of the func
阅读全文
摘要:table { display: block; overflow: scroll; width: 200px; height:95vh; }
阅读全文
摘要:component:
阅读全文
摘要:import { Http, Response, ResponseOptions } from '@angular/http'; import { TestBed } from '@angular/core/testing'; import { BrowserDynamicTestingModule, platformBrowserDynamicTesting } from '@angular/...
阅读全文
摘要:We can write reusable styles with the SCSS @extend or @mixin directives. Which one is better? It depends. A better question is, how do they differ?Ext
阅读全文
摘要:In this lesson you will learn what a LoopBack model is, you will create a Product model using the LoopbBack CLI. The product model will be based off t
阅读全文
摘要:Learn how to create random integers using JavaScript / TypeScript.
阅读全文