Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140161

How to pass the disabled condition, in the ionic button component

$
0
0

I have the following component:

import { Component, OnInit, Input, Output, EventEmitter } from '@angular/core';

@Component({
  selector: 'app-button',
  styleUrls: ['./button.component.scss'],
  template: `
              <ion-button color="{{color}}" (click)="action.emit(null)" [disabled]="condition">
                {{title}}
              </ion-button>
            `
})

export class ButtonComponent implements OnInit {

  @Input() public title: string;
  @Input() public color = 'primary';
  @Input() public condition: any;

  @Output() public action = new EventEmitter();

  constructor() { }

  ngOnInit() {
  }
}

But when I pass the boolean out of it it does not render, because I have a boolean that starts false and becomes true according to the input.

edit: the problem is when validDocument becomes true, the button does not render again and remains disabled.

HTML declaration:

<app-button title="Buscar" (action)="go()" condition="!validDocument"></app-button>

Viewing all articles
Browse latest Browse all 140161

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>