File

src/app/pages/users/add/add-user.component.ts

Implements

OnInit

Metadata

selector ngx-add-user-component
styleUrls add-user.component.scss
templateUrl ./add-user.component.html

Index

Properties
Methods

Constructor

constructor(activatedRoute: ActivatedRoute, apiDataProviderService: ApiDataProviderService)
Parameters :
Name Type Optional
activatedRoute ActivatedRoute no
apiDataProviderService ApiDataProviderService no

Methods

Private initPageWithConfig
initPageWithConfig(config: )
Parameters :
Name Optional
config no
Returns : void
ngOnInit
ngOnInit()
Returns : void

Properties

formList
formList: any
Type : any
Default value : {}
objectKeys
objectKeys:
Default value : Object.keys
pageTitle
pageTitle: string
Type : string
Default value : ''
import {Component, OnInit} from '@angular/core';
import {ActivatedRoute} from "@angular/router";
import * as _ from 'lodash';
import {ApiDataProviderService} from "../../../@core/services/api/api-data-provider.service";

@Component({
  selector: 'ngx-add-user-component',
  styleUrls: ['./add-user.component.scss'],
  templateUrl: './add-user.component.html',
})
export class AddUserComponent implements OnInit {
  pageTitle: string = '';
  formList: any = {}; // title
  objectKeys = Object.keys;

  constructor(private activatedRoute: ActivatedRoute,
              private apiDataProviderService: ApiDataProviderService) {
  }

  ngOnInit() {
    this.initPageWithConfig(_.cloneDeep(this.activatedRoute.snapshot.data));
  }


  private initPageWithConfig(config): void {
    this.pageTitle = config.pageTitle;
    Object.keys(config.forms).forEach(FORM_KEY => {
      config.forms[FORM_KEY].schema.subscribe(res => {
        this.formList[FORM_KEY] = config.forms[FORM_KEY];
        this.formList[FORM_KEY].schema = res;
      })
    });
  }
}
<div class="row">
  <div class="col-sm-12">
    <nb-card>
      <nb-card-header>{{pageTitle}}</nb-card-header>
      <nb-card-body>
        <div class="row">
          <div *ngFor="let form of objectKeys(formList)" class="{{formList[form].containerClass}}">
            <nb-card>
              <nb-card-header>{{formList[form].title}}</nb-card-header>
              <nb-card-body>
                <sf-form [schema]="formList[form].schema">
                </sf-form>
              </nb-card-body>
            </nb-card>
          </div>
        </div>
      </nb-card-body>
    </nb-card>
  </div>
</div>
Legend
Html element
Component
Html element with directive

results matching ""

    No results matching ""