Skip to content

Instantly share code, notes, and snippets.

View timmyBeef's full-sized avatar

Timmy Lin timmyBeef

View GitHub Profile
class Solution {
class Step {
int x;
int y;
int level;
Step(int x, int y) {
this.x = x;
this.y = y;
}
Step(int x, int y, int level) {
public Enum Operation {
PLUS ("+", (x, y) -> x + y)
....
}
List<String> words = List.of("tim", "beef", "lin");
Collections.sort(words, new Comparator<>() {
@Override
public int compare(String s1, String s2) {
return Integer.compare(s1.length(), s2.length()) ;
}
}) ;
<div *ngFor="let item of qaList;let qIndex= index;trackBy:customQTrackBy">
<div class="card">
<div class="card-header bg-info text-white h5">
Q{{(qIndex+1) + '. ' + item.question.questionContent}}
</div>
<div class="row input-group">
<textarea class="form-control" rows=2 name="questions-{{qIndex}}" [(ngModel)]="item.question.questionContent"
#editQ="ngModel" required></textarea>
.........
......
@timmyBeef
timmyBeef / data.ts
Last active October 14, 2018 15:46
DATA - Nested *ngFor Example (Template Driven)
this.qaList = [{
question: <QuestionDto> { questionContent: 'Do you have any hobbies?', questionOrder: 0, isDefaut: true },
answers: [
<AnswerDto> { answerContent: 'I like to swim.', isDefaut: true},
<AnswerDto> { answerContent: 'I like to play basketball.', isDefaut: false},
<AnswerDto> { answerContent: 'I like to play badminton.', isDefaut: false}
]
}];