Commit 5078bd2f authored by Zéfling's avatar Zéfling 🎨

Load files

parent 0971448d
<ul>
<li *ngFor="let line of folders">
<li class="folder"
*ngFor="let line of folders">
<div>
{{line.name}}
</div>
<app-nav [path]="path + '/' + line.name"
[data]="line.data"></app-nav>
</li>
<li *ngFor="let line of files"
(click)="action(path + '/' + line.fileName, line.name)">
<li class="file"
*ngFor="let line of files"
(click)="action(line.fileName)">
{{line.name}}
</li>
</ul>
\ No newline at end of file
import { Component, Input } from '@angular/core';
import { DataValue } from './app.service';
import { DataValue, AppService } from './app.service';
@Component({
selector: 'app-nav',
......@@ -39,5 +39,10 @@ export class AppNavComponent {
return list;
}
constructor(private appService: AppService) { }
action(path: string) {
this.appService.show(this.path + '/' + path);
}
}
......@@ -13,6 +13,7 @@ const pattern = /\.\/([^\/]+)\/(.*)/;
export class AppService {
readonly onData = new Subject<void>();
readonly changePage = new Subject<void>();
isInit = false;
......@@ -28,7 +29,7 @@ export class AppService {
init() {
if (!this.isInit) {
this.http
.get('./assets/browser-conpat-date.txt', { responseType: 'text' })
.get('./assets/browser-compat-data.txt', { responseType: 'text' })
.subscribe(
(data: string) => {
this.parselist(data);
......@@ -79,4 +80,20 @@ export class AppService {
}
}
}
show(path: string) {
this.http
.get('./assets/browser-compat-data' + path, { responseType: 'json' })
.subscribe(
(data: any) => {
console.log(data);
},
() => { },
() => {
this.changePage.next();
});
}
}
......@@ -13,7 +13,6 @@ export class NgForObjectPipe implements PipeTransform {
keys.push({ key: key, value: data[key] });
}
}
console.log('<<<', keys);
return keys;
}
......
......@@ -2,5 +2,5 @@
#!/bin/bash
cd browser-compat-data
# find -L **/**.json > '../browser-conpat-date.txt'
find . -type f \( -iname "*.json" \) > '../browser-conpat-date.txt'
\ No newline at end of file
# find -L **/**.json > '../browser-compat-data.txt'
find . -type f \( -iname "*.json" \) > '../browser-compat-data.txt'
\ No newline at end of file
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment