יש לי פונקציה (getLocalSecurity) שמקבלת ארגומנט משורת הפקודה ומחזירה בוליאני, כפי שנראה כאן:
server.ts: import { getDataService } from './service'; import { getInternalService } from './internal/service'; import { ServiceFactory } from './services/serviceFactory'; קרא עוד →
msg.trim אינו פונקציה.
ניסיתי ליצור קובץ .apk לאנדרואיד ואחרי זה קיבלתי את השגיאה הזו. הסרתי את ההתקנה של npm ו-ionic והתקנתי שוב אבל אני מקבל את אותה השגיאה, בבקשה מישהו יכול לעזור לי לפתור את הבעיה הזו.
C:\>ionic -v 3.16.0 TypeError: msg.trim is not a function at Logger.log (C:\Users\DELL INDIA\AppData\Roaming\npm\node_modules\ionic קרא עוד →
יש לי את הקוד הזה
export function LocalStorage(key?: string) { return WebStorage(localStorage, key); } export function WebStorage(webStorage: Storage, key: string) { return (target: Object, propertyName: string): void => { קרא עוד →
אני מנסה לדחוף מחרוזת חדשה ל-Subject שנקרא period עם .next() אבל הקונסולה נותנת לי שגיאה this.period.next is not a function.
option.component.ts
import { Component, OnInit } from '@angular/core'; import { Subject } from 'rxjs'; @Component({ selector: 'app-option' קרא עוד →אם יש לי
public model; public control = new FormControl(''); control.valueChanges.debounceTime(300).subscribe((value) => { this.model = value; }); myFunc() { console.log(this.model); }אז :
<input [formControl]="control" (keydown.enter)="myFunc()">כפי שאתה יכול לראות, myFunc רץ על ENTER, אז כשאני לוחץ עליו מבלי לחכות 300ms, אני מקבל רק תת-מחרוזת של this.model מאחר ש-valueCh
קרא עוד →
אוקי, אולי מה שהסברתי קודם קשה להסביר.
למעשה אני משתמש ב-AWS Dynamodb כדי להריץ כמה שאילתות ואני מנסה להציג אותן בגרף (NGX-Charts) ב-angular4. עכשיו כדי שהנתונים יוצגו בגרף הם צריכים להיות כמו הדוגמה הזו var shirtInfo =
קרא עוד →בתוך פונקציה אסינכרונית, האם אני צריך להחזיר await כדי שהפונקציה תסתיים כראוי, או שהקוד שלמטה בסדר?
const db = admin.firestore(); export const onUserCreate = functions.auth.user().onCreate(async event => { try { const user: User = { userId: event.data.uid, email: event.data.email }; await db.doc(`users/${user.userId}`).set(user, {merge: true}); } catch (error) { throw error; } }); קרא עוד →
אני די חדש בתכנות פונקציונלי. הנה הפרדיגמה הנוכחית שלי מהאפליקציה שלי ב-React. יש לי קומפוננטה כללית שאליה אני מעביר פונקציה שיכולה באופן אופציונלי לקבל ארגומנט placeholder.
<TableColumn field="effectiveDate" format={dateFormatter} sortable>Start Date</Ta קרא עוד →
האם יש דרך לקבל טיפוסים נכונים במצב כזה?
<Resource data={{ foo: 1 }}>{data => data.foo}</Resource>; ^ should be numberהתחלתי עם דוגמה פשוטה בלי React וזה היה די קל:
type IResult<P> = { [key in keyof P]: P[key] }; function foo<P>( c: (data: IResult<P>) => any, props: { data: P } ) { c(props.data); } foo(data => data.foo, { / קרא עוד →
היה לי את זה:
export const counterReducer: ActionReducer<number> = (state = 0, action: Action) => { const at = CounterActions; switch (action.type) { case at.incrementId: return state + 1; case at.decrementId: return state - 1; case at.resetId: r קרא עוד →