How to manage Angular2 “expression has changed after it was checked” exception when a component property depends on current datetime

Run change detection explicitly after the change: import { ChangeDetectorRef } from ‘@angular/core’; constructor(private cdRef:ChangeDetectorRef) {} ngAfterViewChecked() { console.log( “! changement de la date du composant !” ); this.dateNow = new Date(); this.cdRef.detectChanges(); }

Why shouldn’t you extend JFrame and other components? [duplicate]

Generally speaking, extending the component tends to be done strictly to use the component. This severely limits your options in unnecessary ways in terms of design, so that your classes can’t extend different classes, you can’t hide the JFrame’s methods causing it to be more difficult to maintain and easier to trigger unexpected bugs when … Read more

What is Component-Driven Development?

What is it? I think the definition in your answer covers this question well. Although, I question why the definition includes that a component needs to explicitly define its dependencies. A canonical example of a component is an ActiveX control – do they need to explicitly define their dependencies? What problems does it solve? Management … Read more

How to pass data between two components in Angular 2

You can transfer data using service. Make a service that holds the data while you switch components. Below is an example. import { Injectable } from ‘@angular/core’; @Injectable() export class TransfereService { constructor( private router:Router, private companyServiceService:CompanyServiceService ) { } private data; setData(data){ this.data = data; } getData(){ let temp = this.data; this.clearData(); return temp; … Read more

Conditionally displaying JSF components

Yes, use the rendered attribute. <h:form rendered=”#{some boolean condition}”> You usually tie it to the model rather than letting the model grab the component and manipulate it. E.g. <h:form rendered=”#{bean.booleanValue}” /> <h:form rendered=”#{bean.intValue gt 10}” /> <h:form rendered=”#{bean.objectValue eq null}” /> <h:form rendered=”#{bean.stringValue ne ‘someValue’}” /> <h:form rendered=”#{not empty bean.collectionValue}” /> <h:form rendered=”#{not bean.booleanValue and … Read more