Guest User

Untitled

a guest
Jul 17th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. // Classe de configuração
  2. export class Config {
  3. show: boolean = true;
  4. }
  5.  
  6. // Componente que receberá a classe
  7. @Component({
  8. selector: 'component',
  9. template: '<div *ngIf="show">Can you see me?</div>'
  10. })
  11. export class Component {
  12. @Input() config: Config = new Config(); // instancia a classe para evitar erros
  13.  
  14. show: boolean = this.config.show;
  15. }
  16.  
  17. // usando ambos
  18. <component [config]="config"><component>
Add Comment
Please, Sign In to add comment