Answers for "how to add an answer to grepper"

0

grepper add code answer

to connect relationships and display foreign has links. need to identify 
 *ngIf this.bankAccounts.id == this.company.id similar to Ionic
 
 
 public function index($id = null)
    {
        $this->paginate = [
            'contain' => ['Organizations','Banks', 'Companies'],
        ];
        $bankAccounts = $this->BankAccounts->find();
        if($id){
            $bankAccounts->where(['organization_id' => $id]);
            $organization = $this->BankAccounts->Organizations->findById($id)->first();
            $this->set('organization', $organization);
            
        }
        if ($id){

            $bankAccounts->where(['company_id' => $id]);
            $company = $this->BankAccounts->Companies->findById($id)->first();
            $this->set('company', $company);

        }
        $bankAccounts = $this->paginate($this->BankAccounts);
        $this->set(compact('bankAccounts'));
    }
  
  
  
  
  public function edit($id = null)
    {
        $bankAccount = $this->BankAccounts->get($id, [
            'contain' => [],
        ]);
        $bankAccount = $this->BankAccounts->find();
        if($id){
            $bankAccount->where(['organization_id' => $id]);
            $organization = $this->BankAccounts->Organizations->findById($id)->first();
            $this->set('organization', $organization);
            
        }
        if ($id){

            $bankAccount->where(['company_id' => $id]);
            $company = $this->BankAccounts->Companies->findById($id)->first();
            $this->set('company', $company);

        }
        
        if ($this->request->is(['patch', 'post', 'put'])) {
            $bankAccount = $this->BankAccounts->patchEntity($bankAccount, $this->request->getData());
            if ($this->BankAccounts->save($bankAccount)) {
                $this->Flash->success(__('The bank account has been saved.'));

                return $this->redirect(['action' => 'index']);
            }
            $this->Flash->error(__('The bank account could not be saved. Please, try again.'));
        }
        $organizations = $this->BankAccounts->Organizations->find('list', ['limit' => 200]);
        $companies = $this->BankAccounts->Companies->find('list', ['limit' => 200]);
        $banks = $this->BankAccounts->Banks->find('list', ['limit' => 200]);
        $this->set(compact('bankAccount', 'organizations', 'companies', 'banks'));
    }
Posted by: Guest on May-12-2021
0

grepper add code answer

ngFor filter products based on categories


*ngFor="let item of filteredvalues"    at html


at TS

//filter products by category id 
    this.apiService.getList().subscribe(response => {
      this.productsData = response;
      this.filteredvalues = this.productsData.filter(res => 
        res.category_id == this.id);
      console.log('get all products', this.filteredvalues);
    });
Posted by: Guest on January-19-2021

Browse Popular Code Answers by Language