Sage-Bionetworks / sage-monorepo

Where OpenChallenges, Schematic, and other Sage open source apps are built
https://sage-bionetworks.github.io/sage-monorepo/
Apache License 2.0
21 stars 12 forks source link

[Enhancement] Use Ng Required inputs (Ng v16) #1966

Closed tschaffter closed 11 months ago

tschaffter commented 1 year ago

What projects is this feature for?

OpenChallenges

Description

In v16 now you can mark an input as required:

@Component(...)
export class App {
  @Input({ required: true }) title: string = '';
}

Source: https://blog.angular.io/angular-v16-is-here-4d7a28ec680d

The goal of this ticket is to start using this feature everywhere we can. One could start by searching the projects in **/openchallenges/**/.component.ts for @input occurrences that should be marked as required.

Anything else?

No response

Code of Conduct

tschaffter commented 11 months ago

Here is the error that we get when required inputs are not provided to a component:

Error: libs/openchallenges/team/src/lib/team.component.html:80:1 - error NG8008: Required inputs 'privacyPolicyUrl', 'termsOfUseUrl' from component FooterComponent must be specified.
image

If I had made the @Input as required for the footer component, I would have immediately realized that the input values where not properly specified.