Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added search and mark text option #77

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions example/src/app/app.component.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<ngx-json-viewer [json]="data" [expanded]="false"></ngx-json-viewer>
<input type="text" [(ngModel)]="text">
<ngx-json-viewer [json]="data" [expanded]="true" [searchTerm]="text"></ngx-json-viewer>
<hr />
<ngx-json-viewer [json]="data"></ngx-json-viewer>
<hr />
<ngx-json-viewer [json]="data" [depth]="3"></ngx-json-viewer>
<ngx-json-viewer [json]="data" [depth]="3" [searchTerm]="text"></ngx-json-viewer>
<hr />
<ngx-json-viewer [json]="cyclicData"></ngx-json-viewer>
<ngx-json-viewer [json]="cyclicData"></ngx-json-viewer>
47 changes: 16 additions & 31 deletions example/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,56 +3,41 @@ import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
styleUrls: ['./app.component.css'],
})
export class AppComponent {
text = '';
data = {
'simple key': 'simple value',
'numbers': 1234567,
'simple list': [
'value1',
22222,
'value3'
],
'owner': null,
numbers: 1234567,
'simple list': ['value1', 22222, 'value3'],
owner: null,
'simple obect': {
'simple key': 'simple value',
'numbers': 1234567,
'simple list': [
'value1',
22222,
'value3'
],
numbers: 1234567,
'simple list': ['value1', 22222, 'value3'],
'deep object': {
'key1': {
'deeper': [
1,
2,
3,
],
key1: {
deeper: [1, 2, 3],
},
},
'simple obect': {
'key1': 'value1',
'key2': 22222,
'key3': 'value3'
}
}
key1: 'value1',
key2: 22222,
key3: 'value3',
},
},
};

cyclicData = {
list: [
1,
2,
3,
] as any[],
list: [1, 2, 3] as any[],
};

constructor() {
this.cyclicData.list.push(
this.cyclicData,
this.cyclicData,
this.cyclicData.list,
this.cyclicData.list
);
}
}
14 changes: 5 additions & 9 deletions example/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,12 @@ import { NgModule } from '@angular/core';
import { NgxJsonViewerModule } from 'ngx-json-viewer';

import { AppComponent } from './app.component';
import { FormsModule } from '@angular/forms';

@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
NgxJsonViewerModule,
],
declarations: [AppComponent],
imports: [BrowserModule, FormsModule, NgxJsonViewerModule],
providers: [],
bootstrap: [AppComponent]
bootstrap: [AppComponent],
})
export class AppModule { }
export class AppModule {}
Loading