דיאלוג באנגולר לא נסגר

קדם Forums הייטק Web Development דיאלוג באנגולר לא נסגר

  • דיאלוג באנגולר לא נסגר

    פורסם ע"י תמר פ.  הייטק on 27/08/2023 ב9:29 am

    יש כאן מישהי תותחית באנגולר שאולי תדע לעזור לי?
    יש לי דיאלוג שאני פותחת ע”י לחיצת כפתור, מזינים בו נתונים, ואמור להיסגר בעקבות לחיצה על “שמירה”, במידה והנתונים אכן נשמרו בהצלחה (אם קבלתי 200).
    למעשה, הנתונים נשמרים, אני מקבלת סטטוס קוד 200, אבל הדיאלוג לא נסגר.

    קרה לך? אולי את יודעת מה יכולה להיות הסיבה לכך?

    מירי ו הגיבה לפני 8 חודשים, 3 שבועות 3 חברות · 3 תגובות
  • 3 תגובות
  • רחל פישביין

    חברה
    חברה
    27/08/2023 ב10:02 am

    תוסיפי את הקוד הרלוונטי, בלתי אפשרי לענות בלי נתונים נוספים.

  • תמר פ.

    הייטק
    חברה
    27/08/2023 ב11:28 am

    קצת ארוך, תודה מראש על הסבלנות:

    פתיחה של הדיאלוג:

    public clickedToAddView() {

    this._dialogService.open<SaveViewDialogComponent>(

    {

    title: $localizeSave View,

    content: SaveViewDialogComponent,

    width: '375px !important',

    height: 'auto',

    },

    (comp: SaveViewDialogComponent) => (

    (comp.listStateKeys = this._listStateKeys$$.value)

    )

    );

    }

    הקומפוננטה של הדיאלוג:

    export class SaveViewDialogComponent implements OnInit {

    @Input() public listStateKeys: ListStateKeys<DataModelKey>;

    public newViewFormGroup: UntypedFormGroup;

    public errors: FormErrors<any>;

    public viewVM: {

    viewName: InputViewModel;

    saveAsDefault: InputViewModel;

    availableForAllUsers: InputViewModel;

    };

    constructor(

    private _store: Store<GlobalState>,

    private _logger: Logger,

    private _formBuilder: UntypedFormBuilder

    ) {

    this.newViewFormGroup = this._formBuilder.group({

    viewName: new UntypedFormControl('', Validators.required),

    saveAsDefault: new UntypedFormControl(false),

    availableForAllUsers: new UntypedFormControl(true),

    });

    }

    ngOnInit() {

    this.viewVM = {

    viewName: new InputViewModel({

    formControl: this.newViewFormGroup.controls['viewName'],

    type: InputType.text,

    value: '',

    showTitle: false,

    error: this.errors ? this.errors['viewName'] : null,

    maxLength: 30,

    placeholder: $localizeView Name,

    }),

    saveAsDefault: new InputViewModel({

    formControl: this.newViewFormGroup.controls['saveAsDefault'],

    title: $localizeSave as Default,

    type: InputType.boolean,

    value: false,

    error: this.errors ? this.errors['saveAsDefault'] : null,

    titlePlace: 'after',

    maxLength: 30,

    }),

    availableForAllUsers: new InputViewModel({

    formControl: this.newViewFormGroup.controls['availableForAllUsers'],

    title: $localizeAvailable for All Users,

    type: InputType.boolean,

    value: false,

    error: this.errors ? this.errors['availableForAllUsers'] : null,

    titlePlace: 'after',

    maxLength: 30,

    }),

    };

    }

    האפקט שסוגר את הדיאלוג:

    public saveNewView$ = createEffect(() =>

    this._actions$.pipe(

    ofType(listActions.clickedToSaveNewView),

    switchMap((action) =>

    of(action).pipe(

    withLatestFrom(

    this._store.select(listSelectors.selectGridViewDto(action))

    )

    )

    ),

    switchMap(([action, gridViewDto]) =>

    this._listService.saveNewGridView(gridViewDto).pipe(

    map((savedGridView) =>

    listEffectsActions.gridViewSavedSuccessfully({

    gridView: savedGridView,

    listStateKeys: action.listStateKeys,

    })

    ),

    tap(() => {

    this._dialogService.close();

    }),

    catchError((error: HttpErrorResponse) => {

    this._logger.error(

    An error occurred while saving new Grid View of ${action.listStateKeys.dataModelKey} list. context: ${action.listStateKeys.context}. error: ${error?.message}

    );

    return of(

    listEffectsActions.gridViewSaveFailed({

    listStateKeys: action.listStateKeys,

    })

    );

    })

    )

    )

    )

    );




  • מירי ו

    הייטק
    חברה
    28/08/2023 ב9:08 am

    קשה מאד לקרוא ככה את הקוד צריך לשים את זה בצורה מסודרת אולי בתוך קובץ או משהו

Log in to reply.

מעוניינת בפרסום

חשוב: לא כל פרסום מאושר, נא לפרט בדיוק במה מדובר

ניתן לפנות גם במייל ל: [email protected]

מה את מחפשת?

מילות מפתח פופולריות לפי תחומים

ניתן לחפש גם מילות מפתח , תפקידים וכישרון מיוחד שאינם מופיעים ברשימות - "נהגת", "ציור בחול" וכדומה.

דילוג לתוכן