- 為了能讓大家能夠順利的建立起 Angular 8 開發環境,以下是需要安裝的相關軟體與安裝步驟與說明。
- Windows 7 以上版本 (更新到最新 Service Pack 版本)
- Mac OS X 10.6 以上版本
internal class 使用非同步製作Pizza: 使用同步製作Pizza | |
{ | |
private static int Pizza總數 = 0; | |
private static object tsLock = new object(); | |
internal void 開始() | |
{ | |
var watch = Stopwatch.StartNew(); | |
Console.WriteLine("開始進行製作披薩..."); |
New in Chrome 80 | Web | Google Developers | |
https://developers.google.com/web/updates/2020/02/nic80?fbclid=IwAR2nKXVG8kxLpJ2kgwVbLqYiAbEIXvGUMkeiuKFcQczVhgbHJoo470RyFww#opt-chaining | |
var ABC = function(){this.a = '123'} | |
ABC.prototype._fun1 = function(){return this.a.length} | |
ABC.prototype._fun2 = function(){return this.b?.length} | |
var abc = new ABC(); | |
abc._fun1() // 3 |
<!-- *ngIf, else, ng-container 與 ng-template 搭配使用 --> | |
<span class="highlight"> | |
<ng-container *ngIf="keyword === ''; then pleaseInput; else yourInput"></ng-container> | |
<ng-template #pleaseInput> | |
請輸入關鍵字 | |
</ng-template> | |
<ng-template #yourInput> | |
你輸入: {{ keyword }} | |
</ng-template> | |
</span> |
//Creation Operator - from 輸入陣列 or 字串 or Promise 物件 | |
var arr = ['Jerry', 'Anna', 2016, 2017, '30 days'] | |
var source = Rx.Observable.from(arr); | |
source.subscribe({ | |
next: function(value) { | |
console.log(value) | |
}, | |
complete: function() { |
// Operators - combineLatest | |
/* | |
同時執行多個 observable 實例, | |
且湊齊所有的 next 才會執行 Callack Function | |
每湊齊一次,執行一次 Callack Function | |
其中一個 observable 只要一有值,就會保留(延續),直到被自己覆蓋。 | |
適合用在多 observable,只會變動其中一個 observable,但又要湊齊變數。 | |
*/ | |
var source = Rx.Observable.interval(500).take(3); |
// Operators - zip | |
var source = Rx.Observable.interval(500).take(3); | |
var newest = Rx.Observable.interval(300).take(6); | |
var example = source.zip(newest, (x, y) => x + y); | |
example.subscribe({ | |
next: (value) => { console.log(value); }, | |
error: (err) => { console.log('Error: ' + err); }, | |
complete: () => { console.log('complete'); } |
// Operators - withLatestFrom | |
var main = Rx.Observable.from([1,2,3,4,5]).zip(Rx.Observable.interval(500), (x, y) => x); | |
var some = Rx.Observable.from([0,1,0,0,0,1]).zip(Rx.Observable.interval(300), (x, y) => x); | |
var example = main.withLatestFrom(some, (x, y) => { | |
return y === 1 ? x*10 : x; | |
}); | |
example.subscribe({ | |
next: (value) => { console.log(value); }, |
//1. 正常 情況 | |
var people = [ | |
{name: 'Anna', score: 100, subject: 'English'}, | |
{name: 'Anna', score: 90, subject: 'Math'}, | |
{name: 'Anna', score: 96, subject: 'Chinese' }, | |
{name: 'Jerry', score: 80, subject: 'English'}, | |
{name: 'Jerry', score: 100, subject: 'Math'}, | |
{name: 'Jerry', score: 90, subject: 'Chinese' }, | |
]; | |
var source = Rx.Observable |
```sql | |
SELECT name AS [Database Name], | |
recovery_model_desc AS [Recovery Model] FROM sys.databases | |
GO | |
``` | |
 |