Open
Conversation
| @Pipe({ name: 'value' }) | ||
| export class ValuePipe implements PipeTransform { | ||
| transform(value: any): any { | ||
| if(!value){ |
There was a problem hiding this comment.
I would turn this to use a conditional operator !value ? value : Object.values(value)
| const getNameValidator = (required: boolean = false) => { | ||
| if (required) { | ||
| return [Validators.pattern('^[a-zA-Z_][a-zA-Z0-9_]*$'), Validators.required, Validators.max(100)]; | ||
| } else { |
There was a problem hiding this comment.
The else here is not necessary, right?
| } | ||
|
|
||
| const invalidNameMessage = (type: string = '') => { | ||
| type = type + ' '; |
There was a problem hiding this comment.
Modifying an input parameter?
| if (name === '') { | ||
| return ''; | ||
| } | ||
| else if (regex.test(name) && name.length <= 100) { |
There was a problem hiding this comment.
Flatten the conditions, what is worse then else is else if ;)
| templateUrl: './uml.component.html', | ||
| styleUrls: ['./uml.component.scss'] | ||
| styleUrls: ['./uml.component.scss'], | ||
| changeDetection: ChangeDetectionStrategy.OnPush |
| $(e.source.element.nativeElement).css('z-index', 9000); | ||
| } | ||
|
|
||
| onDragging(){ |
There was a problem hiding this comment.
Did you check the performance? I could imagine that the change detection goes nuts here. I would prefer a directive to manipulate the position of the element, but probably it would be a bit of work to refactore it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The uml component was organised into an own module and turned into a pure component. The module contains the pure component that should always behave in the same way with the same input. The uml container component injects the uml service and hands over the data from the service via an async pipe to the pure component.
Another terminology is the one of smart and dumb components. A dumb component is a pure (or presentational) component, a smart component is a container component.