Skip to content

Commit

Permalink
Merge pull request #15 from alexNJF/revert-14-fix/error-not-fire-in-p…
Browse files Browse the repository at this point in the history
…roduction

Revert "fix: tof"
  • Loading branch information
alexNJF authored Aug 21, 2023
2 parents 5ca2556 + f3d50c4 commit f0f5ea0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 28 deletions.
2 changes: 0 additions & 2 deletions src/app/pages/touterial/services/articles.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ export class ArticlesService {
constructor() { }

setArticle(value:string){
console.log('oooyyy');

this.articleName$.next(value)
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/pages/touterial/touterial.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<div
class="content"
content>
<markdown [data]="markdown"></markdown>
<markdown (load)="onLoad($event)" (error)="onError($event)" [src]="articleSrc"></markdown>
<div class="toc">
<app-toc [reload]="reloadToc" />
</div>
Expand Down
29 changes: 4 additions & 25 deletions src/app/pages/touterial/touterial.component.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { AfterViewInit, Component, Inject } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ArticlesService } from './services/articles.service';
import { MarkdownService } from 'ngx-markdown';
import { concatMap, mergeMap, tap } from 'rxjs/operators';
@Component({
selector: 'app-touterial',
templateUrl: './touterial.component.html',
Expand All @@ -11,50 +9,31 @@ import { concatMap, mergeMap, tap } from 'rxjs/operators';
export class TouterialComponent {
reloadToc = '';
articleSrc?= '/assets/docs/contributing.md'
markdown: string ='';
constructor(
private articlesService: ArticlesService,
private markdownService: MarkdownService

) {

this.getArticleName()
}

getArticleName() {
// console.log('in function');

// this.articlesService.articleName$.pipe(
// mergeMap(value => this.markdownService.getSource(`/assets/docs/${value.replaceAll('/', '-')}.md`))
// ).subscribe(res=>{
// console.log(res);

// })
this.articlesService.articleName$
.subscribe(
articleName => {
// this.articleSrc = `/assets/docs/${articleName.replaceAll('/', '-')}.md`;
this.markdownService.getSource(`/assets/docs/${articleName.replaceAll('/', '-')}.md`).subscribe(
{

next: (v) => { this.markdown = v; console.log(v) },
error: (e) => console.error(e),
complete: () => console.info('complete')

}

)
this.articleSrc = `/assets/docs/${articleName.replaceAll('/', '-')}.md`;
}
);

}

onLoad(event: any) {
this.reloadToc = this.articleSrc + '';
console.log('Event: ', event);
console.log('Event: ',event);

}
onError(event: any) {
console.log('نام فایل : ', (event.url as string).split('/').pop());
console.log('نام فایل : ',(event.url as string).split('/').pop());
this.articleSrc = '/assets/docs/not-found.md'
}

Expand Down

0 comments on commit f0f5ea0

Please sign in to comment.